@@ -325,6 +325,10 @@ public static int updateStringCopyBound(final JsonIterator iter, final int bound
325325
326326 static final int readPositiveInt (final JsonIterator iter , byte c ) throws IOException {
327327 int ind = IterImplNumber .intDigits [c ];
328+ if (ind == 0 ) {
329+ IterImplForStreaming .assertNotLeadingZero (iter );
330+ return 0 ;
331+ }
328332 if (ind == IterImplNumber .INVALID_CHAR_FOR_NUMBER ) {
329333 throw iter .reportError ("readPositiveInt" , "expect 0~9" );
330334 }
@@ -335,9 +339,6 @@ static final int readPositiveInt(final JsonIterator iter, byte c) throws IOExcep
335339 iter .head = i ;
336340 return ind ;
337341 }
338- if (ind == 0 ) {
339- throw iter .reportError ("readPositiveInt" , "leading zero is invalid for int" );
340- }
341342 int ind3 = IterImplNumber .intDigits [iter .buf [++i ]];
342343 if (ind3 == IterImplNumber .INVALID_CHAR_FOR_NUMBER ) {
343344 iter .head = i ;
@@ -380,6 +381,10 @@ static final int readPositiveInt(final JsonIterator iter, byte c) throws IOExcep
380381
381382 static final long readPositiveLong (final JsonIterator iter , byte c ) throws IOException {
382383 long ind = IterImplNumber .intDigits [c ];
384+ if (ind == 0 ) {
385+ IterImplForStreaming .assertNotLeadingZero (iter );
386+ return 0 ;
387+ }
383388 if (ind == IterImplNumber .INVALID_CHAR_FOR_NUMBER ) {
384389 throw iter .reportError ("readPositiveLong" , "expect 0~9" );
385390 }
@@ -390,9 +395,6 @@ static final long readPositiveLong(final JsonIterator iter, byte c) throws IOExc
390395 iter .head = i ;
391396 return ind ;
392397 }
393- if (ind == 0 ) {
394- throw iter .reportError ("readPositiveLong" , "leading zero is invalid for long" );
395- }
396398 int ind3 = IterImplNumber .intDigits [iter .buf [++i ]];
397399 if (ind3 == IterImplNumber .INVALID_CHAR_FOR_NUMBER ) {
398400 iter .head = i ;
0 commit comments