@@ -220,20 +220,23 @@ null, new CBORExtendedFloat(), new CBORExtendedRational()
220220
221221 private static CBORObject [] valueFixedObjects = InitializeFixedObjects ();
222222
223- private int itemtypeValue ;
224- private Object itemValue ;
225- private int tagHigh ;
226- private int tagLow ;
223+ private final int itemtypeValue ;
224+ private final Object itemValue ;
225+ private final int tagHigh ;
226+ private final int tagLow ;
227227
228228 CBORObject (CBORObject obj , int tagLow , int tagHigh ) {
229- this (CBORObjectTypeTagged , obj );
229+ this .itemtypeValue = CBORObjectTypeTagged ;
230+ this .itemValue = obj ;
230231 this .tagLow = tagLow ;
231232 this .tagHigh = tagHigh ;
232233 }
233234
234235 CBORObject (int type , Object item ) {
235236 this .itemtypeValue = type ;
236237 this .itemValue = item ;
238+ this .tagLow = 0 ;
239+ this .tagHigh = 0 ;
237240 }
238241
239242 /**
@@ -784,7 +787,9 @@ public static CBORObject DecodeFromBytes(
784787 return o ;
785788}
786789finally {
787- try { if (ms != null )ms .close (); } catch (java .io .IOException ex ) {}
790+ try { if (ms != null ) {
791+ ms .close ();
792+ } } catch (java .io .IOException ex ) {}
788793}
789794}
790795 }
@@ -2380,13 +2385,13 @@ public CBORObject Add(Object key, Object valueOb) {
23802385 mapKey = CBORObject .Null ;
23812386 } else {
23822387 mapKey = ((key instanceof CBORObject ) ? (CBORObject )key : null );
2383- mapKey = (mapKey == null ) ? (CBORObject .FromObject (key )) : mapKey ;
2388+ mapKey = (mapKey == null ) ? (CBORObject .FromObject (key )) : mapKey ;
23842389 }
23852390 if (valueOb == null ) {
23862391 mapValue = CBORObject .Null ;
23872392 } else {
23882393 mapValue = ((valueOb instanceof CBORObject ) ? (CBORObject )valueOb : null );
2389- mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
2394+ mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
23902395 }
23912396 Map <CBORObject , CBORObject > map = this .AsMap ();
23922397 if (map .containsKey (mapKey )) {
@@ -3163,7 +3168,9 @@ public byte[] EncodeToBytes(CBOREncodeOptions options) {
31633168 return ms .toByteArray ();
31643169}
31653170finally {
3166- try { if (ms != null )ms .close (); } catch (java .io .IOException ex ) {}
3171+ try { if (ms != null ) {
3172+ ms .close ();
3173+ } } catch (java .io .IOException ex ) {}
31673174}
31683175 } catch (IOException ex ) {
31693176 throw new CBORException ("I/O Error occurred" , ex );
@@ -3432,7 +3439,7 @@ public CBORObject Insert(int index, Object valueOb) {
34323439 mapValue = CBORObject .Null ;
34333440 } else {
34343441 mapValue = ((valueOb instanceof CBORObject ) ? (CBORObject )valueOb : null );
3435- mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
3442+ mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
34363443 }
34373444 list .add (index , mapValue );
34383445 } else {
@@ -3563,13 +3570,13 @@ public CBORObject Set(Object key, Object valueOb) {
35633570 mapKey = CBORObject .Null ;
35643571 } else {
35653572 mapKey = ((key instanceof CBORObject ) ? (CBORObject )key : null );
3566- mapKey = (mapKey == null ) ? (CBORObject .FromObject (key )) : mapKey ;
3573+ mapKey = (mapKey == null ) ? (CBORObject .FromObject (key )) : mapKey ;
35673574 }
35683575 if (valueOb == null ) {
35693576 mapValue = CBORObject .Null ;
35703577 } else {
35713578 mapValue = ((valueOb instanceof CBORObject ) ? (CBORObject )valueOb : null );
3572- mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
3579+ mapValue = (mapValue == null ) ? (CBORObject .FromObject (valueOb )) : mapValue ;
35733580 }
35743581 Map <CBORObject , CBORObject > map = this .AsMap ();
35753582 if (map .containsKey (mapKey )) {
@@ -3681,7 +3688,7 @@ public String ToJSONString() {
36813688 }
36823689 sb .append (simvalue );
36833690 } else {
3684- sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
3691+ sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
36853692 sb .append ("simple(" );
36863693 int thisItemInt = ((Integer )this .getThisItem ()).intValue ();
36873694 sb .append (
@@ -3739,7 +3746,7 @@ public String ToJSONString() {
37393746 break ;
37403747 }
37413748 case CBORObjectTypeByteString : {
3742- sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
3749+ sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
37433750 sb .append ("h'" );
37443751 CBORUtilities .ToBase16 (sb , (byte [])this .getThisItem ());
37453752 sb .append ("'" );
@@ -3755,7 +3762,7 @@ public String ToJSONString() {
37553762 break ;
37563763 }
37573764 case CBORObjectTypeArray : {
3758- sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
3765+ sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
37593766 boolean first = true ;
37603767 sb .append ("[" );
37613768 for (CBORObject i : this .AsList ()) {
@@ -3769,7 +3776,7 @@ public String ToJSONString() {
37693776 break ;
37703777 }
37713778 case CBORObjectTypeMap : {
3772- sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
3779+ sb = (sb == null ) ? ((new StringBuilder ())) : sb ;
37733780 boolean first = true ;
37743781 sb .append ("{" );
37753782 Map <CBORObject , CBORObject > map = this .AsMap ();
@@ -4136,13 +4143,13 @@ List<CBORObject> AsList() {
41364143Map <CBORObject , CBORObject > AsMap () {
41374144 return (Map <CBORObject , CBORObject >)this .getThisItem ();
41384145 }
4139-
4146+ /*
41404147 void Redefine(CBORObject cbor) {
41414148 this.itemtypeValue = cbor.itemtypeValue;
41424149 this.tagLow = cbor.tagLow;
41434150 this.tagHigh = cbor.tagHigh;
41444151 this.itemValue = cbor.itemValue;
4145- }
4152+ } */
41464153
41474154 private static boolean BigIntFits (EInteger bigint ) {
41484155 return bigint .GetSignedBitLength () <= 64 ;
@@ -4238,7 +4245,7 @@ private static int CBORMapHashCode(Map<CBORObject, CBORObject> a) {
42384245 // how CBORObjects ought to be compared (since a stable
42394246 // sort order is necessary for two equal maps to have the
42404247 // same hash code), which is much too difficult to do.
4241- return ( a .size () * 19 ) ;
4248+ return a .size () * 19 ;
42424249 }
42434250
42444251 private static void CheckCBORLength (
0 commit comments