@@ -80,19 +80,15 @@ static String NextJSONString(CharacterReader reader, int quote) {
8080 c <<= 4 ;
8181 c |= ch + 10 - 'a' ;
8282 } else {
83- throw
84- reader .NewError (
85- "Invalid Unicode escaped character" );
83+ throw reader .NewError ("Invalid Unicode escaped character" );
8684 }
8785 }
8886 break ;
8987 }
90- default :
91- throw reader .NewError ("Invalid escaped character" );
88+ default : throw reader .NewError ("Invalid escaped character" );
9289 }
9390 break ;
94- default :
95- escaped = false ;
91+ default : escaped = false ;
9692 break ;
9793 }
9894 if (surrogate ) {
@@ -161,8 +157,7 @@ static CBORObject NextJSONValue(
161157 }
162158 if (c == 't' ) {
163159 // Parse true
164- if (reader .NextChar () != 'r' ||
165- reader .NextChar () != 'u' ||
160+ if (reader .NextChar () != 'r' || reader .NextChar () != 'u' ||
166161 reader .NextChar () != 'e' ) {
167162 throw reader .NewError ("Value can't be parsed." );
168163 }
@@ -171,19 +166,16 @@ static CBORObject NextJSONValue(
171166 }
172167 if (c == 'f' ) {
173168 // Parse false
174- if (reader .NextChar () != 'a' ||
175- reader .NextChar () != 'l' ||
176- reader .NextChar () != 's' ||
177- reader .NextChar () != 'e' ) {
169+ if (reader .NextChar () != 'a' || reader .NextChar () != 'l' ||
170+ reader .NextChar () != 's' || reader .NextChar () != 'e' ) {
178171 throw reader .NewError ("Value can't be parsed." );
179172 }
180173 nextChar [0 ] = SkipWhitespaceJSON (reader );
181174 return CBORObject .False ;
182175 }
183176 if (c == 'n' ) {
184177 // Parse null
185- if (reader .NextChar () != 'u' ||
186- reader .NextChar () != 'l' ||
178+ if (reader .NextChar () != 'u' || reader .NextChar () != 'l' ||
187179 reader .NextChar () != 'l' ) {
188180 throw reader .NewError ("Value can't be parsed." );
189181 }
@@ -286,19 +278,18 @@ static CBORObject ParseJSONObject(
286278 }
287279 // NOTE: Will overwrite existing value
288280 myHashMap .put (key , NextJSONValue (
289- reader ,
281+ reader ,
290282 SkipWhitespaceJSON (reader ),
291- noDuplicates ,
292- nextchar ,
293- depth ));
283+ noDuplicates ,
284+ nextchar ,
285+ depth ));
294286 switch (nextchar [0 ]) {
295287 case ',' :
296288 seenComma = true ;
297289 break ;
298290 case '}' :
299291 return CBORObject .FromRaw (myHashMap );
300- default :
301- throw reader .NewError ("Expected a ',' or '}'" );
292+ default : throw reader .NewError ("Expected a ',' or '}'" );
302293 }
303294 }
304295 }
@@ -329,11 +320,11 @@ static CBORObject ParseJSONArray(
329320 }
330321 myArrayList .add (
331322 NextJSONValue (
332- reader ,
333- c ,
334- noDuplicates ,
335- nextchar ,
336- depth ));
323+ reader ,
324+ c ,
325+ noDuplicates ,
326+ nextchar ,
327+ depth ));
337328 c = nextchar [0 ];
338329 switch (c ) {
339330 case ',' :
@@ -366,8 +357,7 @@ static void WriteJSONStringUnquoted(
366357 sb .WriteChar ('\\' );
367358 sb .WriteChar (c );
368359 } else if (c < 0x20 || (c >= 0x85 && (c == 0x2028 || c == 0x2029 ||
369- c == 0x85 || c == 0xfeff || c == 0xfffe ||
370-
360+ c == 0x85 || c == 0xfeff || c == 0xfffe ||
371361 c == 0xffff ))) {
372362 // Control characters, and also the line and paragraph separators
373363 // which apparently can't appear in JavaScript (as opposed to
@@ -434,38 +424,33 @@ static void WriteJSONToInternal(
434424 case CBORObject .CBORObjectTypeSingle : {
435425 float f = ((Float )thisItem ).floatValue ();
436426 if (((f ) == Float .NEGATIVE_INFINITY ) ||
437- ((f ) == Float .POSITIVE_INFINITY ) ||
438- Float .isNaN (f )) {
427+ ((f ) == Float .POSITIVE_INFINITY ) || Float .isNaN (f )) {
439428 writer .WriteString ("null" );
440429 return ;
441430 }
442431 writer .WriteString (
443432 CBORObject .TrimDotZero (
444- Float .toString ((float )f )));
433+ Float .toString ((float )f )));
445434 return ;
446435 }
447436 case CBORObject .CBORObjectTypeDouble : {
448437 double f = ((Double )thisItem ).doubleValue ();
449- if (((f ) == Double .NEGATIVE_INFINITY ) ||
450- ((f ) == Double .POSITIVE_INFINITY ) ||
438+ if (((f ) == Double .NEGATIVE_INFINITY ) || ((f ) == Double .POSITIVE_INFINITY ) ||
451439 Double .isNaN (f )) {
452440 writer .WriteString ("null" );
453441 return ;
454442 }
455- writer .WriteString (
456- CBORObject .TrimDotZero (
443+ writer .WriteString (CBORObject .TrimDotZero (
457444 Double .toString ((double )f )));
458445 return ;
459446 }
460447 case CBORObject .CBORObjectTypeInteger : {
461448 long longItem = (((Long )thisItem ).longValue ());
462- writer .WriteString (
463- CBORUtilities .LongToString (longItem ));
449+ writer .WriteString (CBORUtilities .LongToString (longItem ));
464450 return ;
465451 }
466452 case CBORObject .CBORObjectTypeBigInteger : {
467- writer .WriteString (
468- CBORUtilities .BigIntToString ((BigInteger )thisItem ));
453+ writer .WriteString (CBORUtilities .BigIntToString ((BigInteger )thisItem ));
469454 return ;
470455 }
471456 case CBORObject .CBORObjectTypeExtendedDecimal : {
@@ -490,14 +475,13 @@ static void WriteJSONToInternal(
490475 // so convert to double instead
491476 double f = flo .ToDouble ();
492477 if (((f ) == Double .NEGATIVE_INFINITY ) ||
493- ((f ) == Double .POSITIVE_INFINITY ) ||
494- Double .isNaN (f )) {
478+ ((f ) == Double .POSITIVE_INFINITY ) || Double .isNaN (f )) {
495479 writer .WriteString ("null" );
496480 return ;
497481 }
498482 writer .WriteString (
499483 CBORObject .TrimDotZero (
500- Double .toString ((double )f )));
484+ Double .toString ((double )f )));
501485 return ;
502486 }
503487 writer .WriteString (flo .toString ());
@@ -513,11 +497,11 @@ static void WriteJSONToInternal(
513497 writer .WriteChar ('\"' );
514498 if (obj .HasTag (22 )) {
515499 Base64 .WriteBase64 (
516- writer ,
517- byteArray ,
518- 0 ,
519- byteArray .length ,
520- false );
500+ writer ,
501+ byteArray ,
502+ 0 ,
503+ byteArray .length ,
504+ false );
521505 } else if (obj .HasTag (23 )) {
522506 // Write as base16
523507 for (int i = 0 ; i < byteArray .length ; ++i ) {
@@ -526,11 +510,11 @@ static void WriteJSONToInternal(
526510 }
527511 } else {
528512 Base64 .WriteBase64URL (
529- writer ,
530- byteArray ,
531- 0 ,
532- byteArray .length ,
533- false );
513+ writer ,
514+ byteArray ,
515+ 0 ,
516+ byteArray .length ,
517+ false );
534518 }
535519 writer .WriteChar ('\"' );
536520 break ;
@@ -607,8 +591,7 @@ static void WriteJSONToInternal(
607591 for (Map .Entry <CBORObject , CBORObject > entry : objMap .entrySet ()) {
608592 CBORObject key = entry .getKey ();
609593 CBORObject value = entry .getValue ();
610- String str = (key .getItemType () ==
611- CBORObject .CBORObjectTypeTextString ) ?
594+ String str = (key .getItemType () == CBORObject .CBORObjectTypeTextString ) ?
612595 ((String )key .getThisItem ()) : key .ToJSONString ();
613596 stringMap .put (str , value );
614597 }
0 commit comments