@@ -41,55 +41,55 @@ public class JSONParser {
41
41
public final static int IGNORE_CONTROL_CHAR = 8 ;
42
42
/**
43
43
* Use int datatype to store number when it's possible.
44
- *
44
+ *
45
45
* @since 1.0.7
46
46
*/
47
47
public final static int USE_INTEGER_STORAGE = 16 ;
48
48
/**
49
49
* Throws exception on excessive 0 leading in digits
50
- *
50
+ *
51
51
* @since 1.0.7
52
52
*/
53
53
public final static int ACCEPT_LEADING_ZERO = 32 ;
54
54
/**
55
55
* Throws exception on useless comma in object and array
56
- *
56
+ *
57
57
* @since 1.0.8
58
58
*/
59
59
public final static int ACCEPT_USELESS_COMMA = 64 ;
60
60
/**
61
61
* Allow Json-smart to use Double or BigDecimal to store floating point
62
62
* value
63
- *
63
+ *
64
64
* You may need to disable HI_PRECISION_FLOAT feature on 32bit to improve
65
65
* parsing performances.
66
- *
66
+ *
67
67
* @since 1.0.9
68
68
*/
69
69
public final static int USE_HI_PRECISION_FLOAT = 128 ;
70
70
/**
71
71
* If enabled json-smart will throws exception if datas are present after
72
72
* the end of the Json data.
73
- *
73
+ *
74
74
* @since 1.0.9-2
75
75
*/
76
76
public final static int ACCEPT_TAILLING_DATA = 256 ;
77
77
/**
78
78
* smart mode, fastest parsing mode. accept lots of non standard json syntax
79
- *
79
+ *
80
80
* @since 2.0.1
81
81
*/
82
82
public final static int ACCEPT_TAILLING_SPACE = 512 ;
83
83
/**
84
84
* smart mode, fastest parsing mode. accept lots of non standard json syntax
85
- *
85
+ *
86
86
* @since 2.2.2
87
87
*/
88
88
public final static int REJECT_127_CHAR = 1024 ;
89
89
90
90
/**
91
91
* Use double if possible for big digits, if no precision lost is observed
92
- *
92
+ *
93
93
* @since 2.4
94
94
*/
95
95
public final static int BIG_DIGIT_UNRESTRICTED = 2048 ;
@@ -100,36 +100,36 @@ public class JSONParser {
100
100
* @since 2.5
101
101
*/
102
102
public static final int LIMIT_JSON_DEPTH = 4096 ;
103
-
104
-
103
+
104
+
105
105
/**
106
106
* smart mode, fastest parsing mode. accept lots of non standard json syntax
107
- *
107
+ *
108
108
* @since 1.0.6
109
109
*/
110
110
public final static int MODE_PERMISSIVE = -1 ;
111
111
/**
112
112
* strict RFC4627 mode.
113
- *
113
+ *
114
114
* slower than PERMISSIVE MODE.
115
- *
115
+ *
116
116
* @since 1.0.6
117
117
*/
118
- public final static int MODE_RFC4627 = USE_INTEGER_STORAGE | USE_HI_PRECISION_FLOAT | ACCEPT_TAILLING_SPACE ;
118
+ public final static int MODE_RFC4627 = USE_INTEGER_STORAGE | USE_HI_PRECISION_FLOAT | ACCEPT_TAILLING_SPACE | LIMIT_JSON_DEPTH ;
119
119
/**
120
120
* Parse Object like json-simple
121
- *
121
+ *
122
122
* Best for an iso-bug json-simple API port.
123
- *
123
+ *
124
124
* @since 1.0.7
125
125
*/
126
- public final static int MODE_JSON_SIMPLE = ACCEPT_USELESS_COMMA | USE_HI_PRECISION_FLOAT | ACCEPT_TAILLING_DATA | ACCEPT_TAILLING_SPACE | REJECT_127_CHAR | BIG_DIGIT_UNRESTRICTED ;
126
+ public final static int MODE_JSON_SIMPLE = ACCEPT_USELESS_COMMA | USE_HI_PRECISION_FLOAT | ACCEPT_TAILLING_DATA | ACCEPT_TAILLING_SPACE | REJECT_127_CHAR | BIG_DIGIT_UNRESTRICTED | LIMIT_JSON_DEPTH ;
127
127
/**
128
128
* Strictest parsing mode
129
- *
129
+ *
130
130
* @since 2.0.1
131
131
*/
132
- public final static int MODE_STRICTEST = USE_INTEGER_STORAGE | USE_HI_PRECISION_FLOAT | REJECT_127_CHAR ;
132
+ public final static int MODE_STRICTEST = USE_INTEGER_STORAGE | USE_HI_PRECISION_FLOAT | REJECT_127_CHAR | LIMIT_JSON_DEPTH ;
133
133
/**
134
134
* Default json-smart processing mode
135
135
*/
@@ -154,7 +154,7 @@ private JSONParserReader getPStream() {
154
154
155
155
/**
156
156
* cached constructor
157
- *
157
+ *
158
158
* @return instance of JSONParserInputStream
159
159
*/
160
160
private JSONParserInputStream getPBinStream () {
@@ -165,7 +165,7 @@ private JSONParserInputStream getPBinStream() {
165
165
166
166
/**
167
167
* cached constructor
168
- *
168
+ *
169
169
* @return instance of JSONParserString
170
170
*/
171
171
private JSONParserString getPString () {
@@ -176,7 +176,7 @@ private JSONParserString getPString() {
176
176
177
177
/**
178
178
* cached constructor
179
- *
179
+ *
180
180
* @return instance of JSONParserByteArray
181
181
*/
182
182
private JSONParserByteArray getPBytes () {
@@ -223,7 +223,7 @@ public <T> T parse(byte[] in, Class<T> mapTo) throws ParseException {
223
223
/**
224
224
* use to return Primitive Type, or String, Or JsonObject or JsonArray
225
225
* generated by a ContainerFactory
226
- * @throws UnsupportedEncodingException
226
+ * @throws UnsupportedEncodingException
227
227
*/
228
228
public Object parse (InputStream in ) throws ParseException , UnsupportedEncodingException {
229
229
return getPBinStream ().parse (in );
0 commit comments