From 6fddd8b53bad644b87e05a672879adcba067b2cb Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Sat, 11 Nov 2017 23:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=86null=E5=BC=80?= =?UTF-8?q?=E5=A4=B4=E7=9A=84=E5=AD=97=E7=AC=A6=E4=B8=B2(=E4=BE=8B?= =?UTF-8?q?=E5=A6=82nullaxx)=E9=83=BD=E8=A7=86=E4=B8=BAnull=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/convert/json/JsonReader.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/org/redkale/convert/json/JsonReader.java b/src/org/redkale/convert/json/JsonReader.java index b2ab6643e..0b0976a9d 100644 --- a/src/org/redkale/convert/json/JsonReader.java +++ b/src/org/redkale/convert/json/JsonReader.java @@ -476,16 +476,10 @@ public class JsonReader extends Reader { } } if (expected != '"' && expected != '\'') { - if (expected == 'n' && text0.length > currpos + 3 && (text0[1 + currpos] == 'u' && text0[2 + currpos] == 'l' && text0[3 + currpos] == 'l')) { - if (text0[++currpos] == 'u' && text0[++currpos] == 'l' && text0[++currpos] == 'l') { - this.position = currpos; - if (text0.length > currpos + 4) { - char ch = text0[currpos + 1]; - if (ch == ',' || ch <= ' ' || ch == '}' || ch == ']' || ch == ':') return null; - } else { - return null; - } - } + if (expected == 'n' && ((text0.length == currpos + 4 && (text0[1 + currpos] == 'u' && text0[2 + currpos] == 'l' && text0[3 + currpos] == 'l')) + || (text0.length > currpos + 4 && (text0[1 + currpos] == 'u' && text0[2 + currpos] == 'l' && text0[3 + currpos] == 'l') + && (text0[4 + currpos] == ',' || text0[4 + currpos] <= ' ' || text0[4 + currpos] == '}' || text0[4 + currpos] == ']' || text0[4 + currpos] == ':')))) { + return null; } else { final int start = currpos; for (;;) { @@ -498,8 +492,8 @@ public class JsonReader extends Reader { this.position = currpos - 1; return new String(text0, start, currpos - start); } - this.position = currpos; - throw new ConvertException("expected a ':' after a key but '" + text0[position] + "' (position = " + position + ") in (" + new String(this.text) + ")"); + //this.position = currpos; + //throw new ConvertException("expected a ':' after a key but '" + text0[position] + "' (position = " + position + ") in (" + new String(this.text) + ")"); } final int start = ++currpos; for (;;) {