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/09 14:21:30 UTC

incubator-johnzon git commit: JOHNZON-34 multi comment line /**/ + fixing some warnings when supporting comments

Repository: incubator-johnzon
Updated Branches:
  refs/heads/master 94b896dfa -> b790844bf


JOHNZON-34 multi comment line /**/ + fixing some warnings when supporting comments


Project: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/commit/b790844b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/tree/b790844b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/diff/b790844b

Branch: refs/heads/master
Commit: b790844bff5ce1ad7dddd08b6accb1275fec65e6
Parents: 94b896d
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Fri Jan 9 14:21:16 2015 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Fri Jan 9 14:21:16 2015 +0100

----------------------------------------------------------------------
 .../apache/johnzon/core/CommentsJsonStreamParserImpl.java |  6 +++---
 .../java/org/apache/johnzon/mapper/MapperBuilder.java     | 10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/b790844b/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 edbe54f..39e9f1c 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
@@ -52,15 +52,15 @@ public class CommentsJsonStreamParserImpl extends JsonStreamParserImpl {
             if (next == '/') { // fail
                 do {
                     next = readNextChar();
-                } while (next != '\n');
+                } while (next != EOL);
                 return next();
             } else if (next == '*') {
                 next = 0;
                 char previous;
                 do {
                     previous = next;
-                    next = readNextChar();
-                } while (next != '/' && previous != '*');
+                    next = readNextNonWhitespaceChar(readNextChar());
+                } while (next != '/' || previous != '*');
                 readNextNonWhitespaceChar(next);
                 return next();
             }

http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/b790844b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
----------------------------------------------------------------------
diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
index c743f8e..f08527d 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
@@ -108,16 +108,18 @@ public class MapperBuilder {
             if (pretty) {
                 config.put(JsonGenerator.PRETTY_PRINTING, true);
             }
+
+            if (generatorFactory == null) {
+                generatorFactory = provider.createGeneratorFactory(config);
+            }
+
+            config.remove(JsonGenerator.PRETTY_PRINTING); // doesnt mean anything anymore for reader
             if (supportsComments) {
                 config.put("org.apache.johnzon.supports-comments", "true");
             }
-
             if (readerFactory == null) {
                 readerFactory = provider.createReaderFactory(config);
             }
-            if (generatorFactory == null) {
-                generatorFactory = provider.createGeneratorFactory(config);
-            }
         }
 
         return new Mapper(