diff options
author | Sven Gothel <[email protected]> | 2015-03-06 08:12:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-06 08:12:30 +0100 |
commit | 5f66fafec303de7d7904a499fefb8e3d023b61ae (patch) | |
tree | eb119a77e297abab18f54f970d46b6e96067e012 /src | |
parent | 1df503b8f14b385b35c6b50a4ff7ff03d1c3134f (diff) |
Bug 1134 - GlueGenException.toString(): Produce a 'gcc' like/compatible error message
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/gluegen/ASTLocusTag.java | 13 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/GlueGenException.java | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/java/com/jogamp/gluegen/ASTLocusTag.java b/src/java/com/jogamp/gluegen/ASTLocusTag.java index ba38276..babe3df 100644 --- a/src/java/com/jogamp/gluegen/ASTLocusTag.java +++ b/src/java/com/jogamp/gluegen/ASTLocusTag.java @@ -48,18 +48,23 @@ public class ASTLocusTag { } public String toString() { + return toString(true); + } + public String toString(final boolean includeText) { final StringBuffer buf = new StringBuffer(); if (source != null) { - buf.append(source).append(": "); + buf.append(source).append(":"); } if (line != -1) { - buf.append("line ").append(line); + buf.append(line); if (column != -1) { buf.append(":" + column); } - buf.append(": "); } - if( null != text && text.length()>0 ) { + if( includeText && null != text && text.length()>0 ) { + if( buf.length() > 0 ) { + buf.append(": "); + } buf.append("text '").append(text).append("'"); } return buf.toString(); diff --git a/src/java/com/jogamp/gluegen/GlueGenException.java b/src/java/com/jogamp/gluegen/GlueGenException.java index 3c52104..e8e06ec 100644 --- a/src/java/com/jogamp/gluegen/GlueGenException.java +++ b/src/java/com/jogamp/gluegen/GlueGenException.java @@ -83,7 +83,10 @@ public class GlueGenException extends JogampRuntimeException { public String toString() { final StringBuffer buf = new StringBuffer(); if (null != locus) { - buf.append(locus).append(": "); + buf.append(locus.toString(false)).append(": error: "); + if( null != locus.text && locus.text.length()>0 ) { + buf.append("text '").append(locus.text).append("': "); + } } buf.append(getLocalizedMessage()); final String message = buf.toString(); |