@@ -415,30 +415,32 @@ static final long readPositiveLong(final JsonIterator iter, byte c) throws IOExc
415415 static final double readPositiveDouble (final JsonIterator iter ) throws IOException {
416416 int oldHead = iter .head ;
417417 try {
418- long value = IterImplNumber .readLong (iter ); // without the dot
419- if (iter .head == iter .tail ) {
420- return value ;
421- }
422- byte c = iter .buf [iter .head ];
423- if (c == '.' ) {
424- iter .head ++;
425- int start = iter .head ;
426- c = iter .buf [iter .head ++];
427- long decimalPart = readPositiveLong (iter , c );
428- int decimalPlaces = iter .head - start ;
429- if (decimalPlaces > 0 && decimalPlaces < IterImplNumber .POW10 .length && (iter .head - oldHead ) < 10 ) {
430- value = value * IterImplNumber .POW10 [decimalPlaces ] + decimalPart ;
431- return value / (double ) IterImplNumber .POW10 [decimalPlaces ];
418+ try {
419+ long value = IterImplNumber .readLong (iter ); // without the dot
420+ if (iter .head == iter .tail ) {
421+ return value ;
422+ }
423+ byte c = iter .buf [iter .head ];
424+ if (c == '.' ) {
425+ iter .head ++;
426+ int start = iter .head ;
427+ c = iter .buf [iter .head ++];
428+ long decimalPart = readPositiveLong (iter , c );
429+ int decimalPlaces = iter .head - start ;
430+ if (decimalPlaces > 0 && decimalPlaces < IterImplNumber .POW10 .length && (iter .head - oldHead ) < 10 ) {
431+ value = value * IterImplNumber .POW10 [decimalPlaces ] + decimalPart ;
432+ return value / (double ) IterImplNumber .POW10 [decimalPlaces ];
433+ } else {
434+ iter .head = oldHead ;
435+ return IterImplForStreaming .readDoubleSlowPath (iter );
436+ }
432437 } else {
433- iter .head = oldHead ;
434- return IterImplForStreaming .readDoubleSlowPath (iter );
438+ return value ;
435439 }
436- } else {
437- if (iter .head < iter .tail && iter .buf [iter .head ] == 'e' ) {
440+ } finally {
441+ if (iter .head < iter .tail && ( iter .buf [iter .head ] == 'e' || iter . buf [ iter . head ] == 'E' ) ) {
438442 iter .head = oldHead ;
439443 return IterImplForStreaming .readDoubleSlowPath (iter );
440- } else {
441- return value ;
442444 }
443445 }
444446 } catch (JsonException e ) {
0 commit comments