From 5f66fafec303de7d7904a499fefb8e3d023b61ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 Mar 2015 08:12:30 +0100 Subject: Bug 1134 - GlueGenException.toString(): Produce a 'gcc' like/compatible error message --- src/java/com/jogamp/gluegen/ASTLocusTag.java | 13 +++++++++---- src/java/com/jogamp/gluegen/GlueGenException.java | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/java') 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(); -- cgit v1.2.3