hannesw@1228: /* hannesw@1228: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. hannesw@1228: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1228: * hannesw@1228: * This code is free software; you can redistribute it and/or modify it hannesw@1228: * under the terms of the GNU General Public License version 2 only, as hannesw@1228: * published by the Free Software Foundation. hannesw@1228: * hannesw@1228: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1228: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1228: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1228: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1228: * accompanied this code). hannesw@1228: * hannesw@1228: * You should have received a copy of the GNU General Public License version hannesw@1228: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1228: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1228: * hannesw@1228: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1228: * or visit www.oracle.com if you need additional information or have any hannesw@1228: * questions. hannesw@1228: */ hannesw@1228: hannesw@1228: /** hannesw@1228: * JDK-8062141: Various performance issues parsing JSON hannesw@1228: * hannesw@1228: * @test hannesw@1228: * @run hannesw@1228: */ hannesw@1228: hannesw@1228: function testJson(json) { hannesw@1228: try { hannesw@1228: print(JSON.stringify(JSON.parse(json))); hannesw@1228: } catch (error) { hannesw@1228: print(error); hannesw@1228: } hannesw@1228: } hannesw@1228: hannesw@1228: testJson('"\\u003f"'); hannesw@1228: testJson('"\\u0"'); hannesw@1228: testJson('"\\u0"'); hannesw@1228: testJson('"\\u00"'); hannesw@1228: testJson('"\\u003"'); hannesw@1228: testJson('"\\u003x"'); hannesw@1228: testJson('"\\"'); hannesw@1228: testJson('"'); hannesw@1228: testJson('+1'); hannesw@1228: testJson('-1'); hannesw@1228: testJson('1.'); hannesw@1228: testJson('.1'); hannesw@1228: testJson('01'); hannesw@1228: testJson('1e'); hannesw@1228: testJson('1e0'); hannesw@1228: testJson('1a'); hannesw@1228: testJson('1e+'); hannesw@1228: testJson('1e-'); hannesw@1228: testJson('0.0e+0'); hannesw@1228: testJson('0.0e-0'); hannesw@1228: testJson('[]'); hannesw@1228: testJson('[ 1 ]'); hannesw@1228: testJson('[1,]'); hannesw@1228: testJson('[ 1 , 2 ]'); hannesw@1228: testJson('[1, 2'); hannesw@1228: testJson('{}'); hannesw@1228: testJson('{ "a" : "b" }'); hannesw@1228: testJson('{ "a" : "b" '); hannesw@1228: testJson('{ "a" : }'); hannesw@1228: testJson('true'); hannesw@1228: testJson('tru'); hannesw@1228: testJson('true1'); hannesw@1228: testJson('false'); hannesw@1228: testJson('fals'); hannesw@1228: testJson('falser'); hannesw@1228: testJson('null'); hannesw@1228: testJson('nul'); hannesw@1228: testJson('null0'); hannesw@1228: testJson('{} 0'); hannesw@1228: testJson('{} a'); hannesw@1228: testJson('[] 0'); hannesw@1228: testJson('[] a'); hannesw@1228: testJson('1 0'); hannesw@1228: testJson('1 a'); hannesw@1228: testJson('["a":true]'); hannesw@1228: testJson('{"a",truer}'); hannesw@1228: testJson('{"a":truer}'); hannesw@1228: testJson('[1, 2, 3]'); hannesw@1228: testJson('[9223372036854774000, 9223372036854775000, 9223372036854776000]'); hannesw@1228: testJson('[1.1, 1.2, 1.3]'); hannesw@1228: testJson('[1, 1.2, 9223372036854776000, null, true]'); hannesw@1228: testJson('{ "a" : "string" , "b": 1 , "c" : 1.2 , "d" : 9223372036854776000 , "e" : null , "f" : true }'); hannesw@1228: