private double readJsonDouble ( ) throws IOException { context . read ( ) ; if ( reader . peek ( ) == QUOTE [ 0 ] ) { ByteString str = readJsonString ( true ) ; double dub = Double . valueOf ( str . utf8 ( ) ) ; if ( ! context . escapeNum ( ) && ! Double . isNaN ( dub ) && ! Double . isInfinite ( dub ) ) { // Throw exception -- we should not be in a string in this case throw new ProtocolException ( "Numeric data unexpectedly quoted" ) ; } return dub ; } else { if ( context . escapeNum ( ) ) { // This will throw - we should have had a quote if escapeNum == true readJsonSyntaxChar ( QUOTE ) ; } try { return Double . valueOf ( readJsonNumericChars ( ) ) ; } catch ( NumberFormatException ex ) { throw new ProtocolException ( "Bad data encountered in numeric data" ) ; } } }
when expected or if wrapped in quotes when not expected .