You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rm...@apache.org on 2015/01/05 12:05:35 UTC
incubator-johnzon git commit: explicit handling of EOF in error +
better comment handling - ie fail when accurate/not a comment
Repository: incubator-johnzon
Updated Branches:
refs/heads/master 146917e26 -> d9e51a841
explicit handling of EOF in error + better comment handling - ie fail when accurate/not a comment
Project: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/commit/d9e51a84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/tree/d9e51a84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/diff/d9e51a84
Branch: refs/heads/master
Commit: d9e51a841b4bc1d02454713d6284e9e6e3980fea
Parents: 146917e
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon Jan 5 12:05:29 2015 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon Jan 5 12:05:29 2015 +0100
----------------------------------------------------------------------
.../org/apache/johnzon/core/CommentsJsonStreamParserImpl.java | 6 +++---
.../java/org/apache/johnzon/core/JsonStreamParserImpl.java | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/d9e51a84/johnzon-core/src/main/java/org/apache/johnzon/core/CommentsJsonStreamParserImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/CommentsJsonStreamParserImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/CommentsJsonStreamParserImpl.java
index e28c03a..edbe54f 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/CommentsJsonStreamParserImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/CommentsJsonStreamParserImpl.java
@@ -53,6 +53,7 @@ public class CommentsJsonStreamParserImpl extends JsonStreamParserImpl {
do {
next = readNextChar();
} while (next != '\n');
+ return next();
} else if (next == '*') {
next = 0;
char previous;
@@ -61,10 +62,9 @@ public class CommentsJsonStreamParserImpl extends JsonStreamParserImpl {
next = readNextChar();
} while (next != '/' && previous != '*');
readNextNonWhitespaceChar(next);
- } else {
- return super.defaultHandling(c);
+ return next();
}
}
- return next();
+ return super.defaultHandling(c);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/d9e51a84/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
index 0ef9e02..3778b3b 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
@@ -331,9 +331,6 @@ public class JsonStreamParserImpl implements JsonChars, JsonParser{
}
final char c = readNextNonWhitespaceChar(readNextChar());
- if (c == EOF) {
- throw uexc("End of file hit too early");
- }
if (c == COMMA_CHAR) {
@@ -420,6 +417,9 @@ public class JsonStreamParserImpl implements JsonChars, JsonParser{
}
protected Event defaultHandling(char c) {
+ if (c == EOF) {
+ throw uexc("End of file hit too early");
+ }
throw uexc("Expected structural character or digit or 't' or 'n' or 'f' or '-'");
}