File tree Expand file tree Collapse file tree 3 files changed +18
-18
lines changed 
sbe-samples/src/main/java/uk/co/real_logic/sbe/examples 
sbe-tool/src/main/java/uk/co/real_logic/sbe Expand file tree Collapse file tree 3 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,22 @@ private static CharSequence readEncodingAsString(
203203 final  PrimitiveValue  constOrNotPresentValue  = constOrNotPresentValue (typeToken , actingVersion );
204204 if  (null  != constOrNotPresentValue )
205205 {
206-  return  constOrNotPresentValue .toString ();
206+  if  (constOrNotPresentValue .size () == 1 )
207+  {
208+  try 
209+  {
210+  final  byte [] bytes  = { (byte )constOrNotPresentValue .longValue () };
211+  return  new  String (bytes , constOrNotPresentValue .characterEncoding ());
212+  }
213+  catch  (final  UnsupportedEncodingException  ex )
214+  {
215+  throw  new  RuntimeException (ex );
216+  }
217+  }
218+  else 
219+  {
220+  return  constOrNotPresentValue .toString ();
221+  }
207222 }
208223
209224 final  StringBuilder  sb  = new  StringBuilder ();
Original file line number Diff line number Diff line change @@ -364,22 +364,7 @@ public String toString()
364364 switch  (representation )
365365 {
366366 case  LONG :
367-  if  (null  != characterEncoding )
368-  {
369-  try 
370-  {
371-  final  byte [] bytes  = new  byte []{ (byte )longValue  };
372-  return  new  String (bytes , characterEncoding );
373-  }
374-  catch  (final  UnsupportedEncodingException  ex )
375-  {
376-  throw  new  IllegalStateException (ex );
377-  }
378-  }
379-  else 
380-  {
381-  return  Long .toString (longValue );
382-  }
367+  return  Long .toString (longValue );
383368
384369 case  DOUBLE :
385370 return  Double .toString (doubleValue );
Original file line number Diff line number Diff line change @@ -1934,7 +1934,7 @@ private CharSequence generateConstPropertyMethods(
19341934 "\n "  +
19351935 indent  + " public byte %s()\n "  +
19361936 indent  + " {\n "  +
1937-  indent  + " return (byte)'%s' ;\n "  +
1937+  indent  + " return (byte)%s ;\n "  +
19381938 indent  + " }\n \n " ,
19391939 propertyName ,
19401940 encoding .constValue ()));
                         You can’t perform that action at this time. 
           
                  
0 commit comments