fixed Problem in processData in ConnectionHandler.java
and Codecleanup
This commit is contained in:
parent
dad15d52d2
commit
61feb48a86
|
@ -27,8 +27,7 @@ public class ClientConnectionHandler extends ConnectionHandler implements Runnab
|
||||||
|
|
||||||
private final SimpleStringProperty userName;
|
private final SimpleStringProperty userName;
|
||||||
private final SimpleObjectProperty<State> state;
|
private final SimpleObjectProperty<State> state;
|
||||||
private final ClientMessageList
|
private final ClientMessageList messages;
|
||||||
messages;
|
|
||||||
private final SimpleStringProperty serverAddress;
|
private final SimpleStringProperty serverAddress;
|
||||||
private final SimpleIntegerProperty serverPort;
|
private final SimpleIntegerProperty serverPort;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,12 @@ public abstract class ConnectionHandler {
|
||||||
} else if (scanner.hasNextLine()) {
|
} else if (scanner.hasNextLine()) {
|
||||||
receiver.append(scanner.nextLine());
|
receiver.append(scanner.nextLine());
|
||||||
} else {
|
} else {
|
||||||
throw new ChatProtocolException("No Receiver found");
|
throw new ChatProtocolException("No Sender found");
|
||||||
|
}
|
||||||
|
if (scanner.hasNextLine()) {
|
||||||
|
receiver.append(scanner.nextLine());
|
||||||
|
} else {
|
||||||
|
throw new ChatProtocolException("No Reciever found");
|
||||||
}
|
}
|
||||||
if (scanner.hasNextLine()) {
|
if (scanner.hasNextLine()) {
|
||||||
type.append(scanner.nextLine());
|
type.append(scanner.nextLine());
|
||||||
|
@ -119,7 +124,6 @@ public abstract class ConnectionHandler {
|
||||||
*/
|
*/
|
||||||
protected void sendData(String sender, String receiver, String type, String payload) {
|
protected void sendData(String sender, String receiver, String type, String payload) {
|
||||||
if (connection.isAvailable()) {
|
if (connection.isAvailable()) {
|
||||||
new StringBuilder();
|
|
||||||
String data = sender + "\n" +
|
String data = sender + "\n" +
|
||||||
receiver + "\n" +
|
receiver + "\n" +
|
||||||
type + "\n" +
|
type + "\n" +
|
||||||
|
|
Loading…
Reference in New Issue