Apply suggestions from code review
Co-authored-by: CyB3RC0nN0R <CyB3RC0nN0R@users.noreply.github.com>
This commit is contained in:
		@@ -69,8 +69,9 @@ public class Receiver extends Thread {
 | 
			
		||||
					// Get appropriate processor
 | 
			
		||||
					@SuppressWarnings("rawtypes")
 | 
			
		||||
					final Consumer processor = processors.get(obj.getClass());
 | 
			
		||||
					if (processor == null) logger.log(Level.WARNING,
 | 
			
		||||
							String.format("The received object has the class %s for which no processor is defined.", obj.getClass()));
 | 
			
		||||
					if (processor == null)
 | 
			
		||||
						logger.log(Level.WARNING, String.format(
 | 
			
		||||
							"The received object has the class %s for which no processor is defined.", obj.getClass()));
 | 
			
		||||
					else processor.accept(obj);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ public final class Startup extends Application {
 | 
			
		||||
			if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized");
 | 
			
		||||
		} catch (final Exception e) {
 | 
			
		||||
			new Alert(AlertType.ERROR, "Error loading configuration values:\n" + e);
 | 
			
		||||
			logger.log(Level.SEVERE, "Error loading configuration values", e);
 | 
			
		||||
			logger.log(Level.SEVERE, "Error loading configuration values: ", e);
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
			System.exit(1);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -199,15 +199,15 @@ public final class ChatScene {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Checks the text length of the {@code messageTextArea}, adjusts the
 | 
			
		||||
	 * {@code remainingChars} - Label and checks whether to send the message
 | 
			
		||||
	 * {@code remainingChars} label and checks whether to send the message
 | 
			
		||||
	 * automatically.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param e the keys that have been entered
 | 
			
		||||
	 * @param e the key event that will be analyzed for a post request
 | 
			
		||||
	 * @since Envoy Client v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
	@FXML
 | 
			
		||||
	private void checkKeyCombination(KeyEvent e) {
 | 
			
		||||
		// checks whether the text is too long
 | 
			
		||||
		// Checks whether the text is too long
 | 
			
		||||
		messageTextUpdated();
 | 
			
		||||
		// Automatic sending of messages via (ctrl +) enter
 | 
			
		||||
		checkPostConditions(e);
 | 
			
		||||
@@ -219,8 +219,8 @@ public final class ChatScene {
 | 
			
		||||
	 */
 | 
			
		||||
	@FXML
 | 
			
		||||
	private void checkPostConditions(KeyEvent e) {
 | 
			
		||||
		if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
 | 
			
		||||
				|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())
 | 
			
		||||
		if (!postButton.isDisabled() && (settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
 | 
			
		||||
				|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()))
 | 
			
		||||
			postMessage();
 | 
			
		||||
		postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null);
 | 
			
		||||
	}
 | 
			
		||||
@@ -242,7 +242,7 @@ public final class ChatScene {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Sets the text and text-color of the {@code remainingChars} - Label.
 | 
			
		||||
	 * Sets the text and text color of the {@code remainingChars} label.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @since Envoy Client v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user