Skip to content

Commit

Permalink
Fix read payload
Browse files Browse the repository at this point in the history
  • Loading branch information
NaikSoftware committed May 13, 2016
1 parent 54dfd7c commit b00c7ff
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class StompMessage {
public static final String TERMINATE_MESSAGE_SYMBOL = "\u0000";

private static final Pattern PATTERN_HEADER = Pattern.compile("([^:\\s]+):([^:\\s]+)");
private static final Pattern PATTERN_PAYLOAD = Pattern.compile("[^\\u0000]*");

private final String mStompCommand;
private final List<StompHeader> mStompHeaders;
Expand Down Expand Up @@ -76,7 +75,9 @@ public static StompMessage from(String data) {
}

reader.skip("\\s");
String payload = reader.hasNext(PATTERN_PAYLOAD) ? reader.next(PATTERN_PAYLOAD) : null;

reader.useDelimiter(TERMINATE_MESSAGE_SYMBOL);
String payload = reader.hasNext() ? reader.next() : null;

return new StompMessage(command, headers, payload);
}
Expand Down

0 comments on commit b00c7ff

Please sign in to comment.