@@ -293,15 +293,19 @@ def printAppendArgumentDebugStringTo(c):
293293 def optionalValueClause (jField , jType ):
294294 if jType in java_scalar_types :
295295 return "this.%sIsSet ? String.valueOf(this.%s) : \" unset\" " % (jField , jField )
296- else :
296+ elif jType == "String" :
297297 return "this.%s" % (jField )
298+ else :
299+ return "String.valueOf(this.%s)" % (jField )
298300
299301 appendList = [ "%s=\" )\n .append(%s)\n .append(\" "
300302 % (f .name , optionalValueClause (java_field_name (f .name ), java_field_type (spec , f .domain )))
301303 for f in c .fields ]
302304 print
303- print " public void appendArgumentDebugStringTo(StringBuilder acc) {"
304- print " acc.append(\" (%s)\" );" % (", " .join (appendList ))
305+ print " public void appendArgumentDebugStringTo(Appendable acc) {"
306+ print " try {"
307+ print " acc.append(\" (%s)\" );" % (", " .join (appendList ))
308+ print " } catch(IOException _) { }"
305309 print " }"
306310
307311 def printPropertiesBuilderClass (c ):
@@ -521,12 +525,21 @@ def trueOrFalse(truthVal):
521525 return "false"
522526
523527 def argument_debug_string ():
524- appendList = [ "%s=\" )\n .append(this.%s)\n .append(\" "
525- % (a .name , java_field_name (a .name ))
528+ def appendFieldValue (a ):
529+ (jName , jType ) = (java_field_name (a .name ), java_field_type (spec , a .domain ))
530+ if jType == "String" :
531+ return "this.%s" % (jName )
532+ else :
533+ return "String.valueOf(this.%s)" % (jName )
534+
535+ appendList = [ "%s=\" )\n .append(%s)\n .append(\" "
536+ % (a .name , appendFieldValue (a ))
526537 for a in m .arguments ]
527538 print
528- print " public void appendArgumentDebugStringTo(StringBuilder acc) {"
529- print " acc.append(\" (%s)\" );" % ", " .join (appendList )
539+ print " public void appendArgumentDebugStringTo(Appendable acc) {"
540+ print " try {"
541+ print " acc.append(\" (%s)\" );" % ", " .join (appendList )
542+ print " } catch(IOException _) { }"
530543 print " }"
531544
532545 def write_arguments ():
0 commit comments