@@ -3563,52 +3563,46 @@ private String repeat(String s, int times) {
35633563 return stringBuilder .toString ();
35643564 }
35653565
3566+ @ SuppressWarnings ("unchecked" )
35663567 @ Test
35673568 void testParseDeeplyNestedArrays () throws IOException {
3568- int times = 10000 ;
3569+ int times = 1000 ;
35693570 // [[[ ... ]]]
35703571 String json = repeat ("[" , times ) + repeat ("]" , times );
35713572
35723573 int actualTimes = 0 ;
3573- try {
3574- List <Object > current = U .fromJson (json );
3575- while (true ) {
3576- actualTimes ++;
3577- if (current .isEmpty ()) {
3578- break ;
3579- }
3580- assertEquals (1 , current .size ());
3581- current = (List <Object >) current .get (0 );
3574+ List <Object > current = U .fromJson (json );
3575+ while (true ) {
3576+ actualTimes ++;
3577+ if (current .isEmpty ()) {
3578+ break ;
35823579 }
3583- assertEquals (times , actualTimes );
3584- } catch (Throwable throwable ) {
3585- assertTrue (throwable instanceof StackOverflowError );
3580+ assertEquals (1 , current .size ());
3581+ current = (List <Object >) current .get (0 );
35863582 }
3583+ assertEquals (times , actualTimes );
35873584 }
35883585
3586+ @ SuppressWarnings ("unchecked" )
35893587 @ Test
35903588 void testParseDeeplyNestedObjects () throws IOException {
3591- int times = 10000 ;
3589+ int times = 1000 ;
35923590 // {"a":{"a": ... {"a":null} ... }}
35933591 String json = repeat ("{\" a\" :" , times ) + "null" + repeat ("}" , times );
35943592
35953593 int actualTimes = 0 ;
3596- try {
3597- Map <String , Object > current = U .fromJsonMap (json );
3598- while (true ) {
3599- assertEquals (1 , current .size ());
3600- actualTimes ++;
3601- Map <String , Object > next = (Map <String , Object >) current .get ("a" );
3602- if (next == null ) {
3603- break ;
3604- } else {
3605- current = next ;
3606- }
3594+ Map <String , Object > current = U .fromJsonMap (json );
3595+ while (true ) {
3596+ assertEquals (1 , current .size ());
3597+ actualTimes ++;
3598+ Map <String , Object > next = (Map <String , Object >) current .get ("a" );
3599+ if (next == null ) {
3600+ break ;
3601+ } else {
3602+ current = next ;
36073603 }
3608- assertEquals (times , actualTimes );
3609- } catch (Throwable throwable ) {
3610- assertTrue (throwable instanceof StackOverflowError );
36113604 }
3605+ assertEquals (times , actualTimes );
36123606 }
36133607
36143608 @ Test
0 commit comments