summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/GlueGen.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-02-20 18:55:46 +0100
committerMichael Bien <[email protected]>2010-02-20 18:55:46 +0100
commitc16d2358346a72e4cb1c4a5b36749c7785912fcf (patch)
tree18bf517854cba67b220d2d3791ba556576fa95e0 /src/java/com/sun/gluegen/GlueGen.java
parent3bdc000de6c220d6fc0676ddea4da67b46708092 (diff)
better exception handling in GlueGen.
WIP: refactored PCPP to implement macros, next step is to replace StreamTokenizer with Scanner (we need a propper look ahead).
Diffstat (limited to 'src/java/com/sun/gluegen/GlueGen.java')
-rw-r--r--src/java/com/sun/gluegen/GlueGen.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/java/com/sun/gluegen/GlueGen.java b/src/java/com/sun/gluegen/GlueGen.java
index 7c1fa4c..68d65d7 100644
--- a/src/java/com/sun/gluegen/GlueGen.java
+++ b/src/java/com/sun/gluegen/GlueGen.java
@@ -154,15 +154,11 @@ public class GlueGen implements GlueEmitterControls {
// invoke parser
try {
- parser.translationUnit();
- }
- catch (RecognitionException e) {
- System.err.println("Fatal IO error:\n"+e);
- System.exit(1);
- }
- catch (TokenStreamException e) {
- System.err.println("Fatal IO error:\n"+e);
- System.exit(1);
+ parser.translationUnit();
+ } catch (RecognitionException e) {
+ throw new RuntimeException("Fatal IO error", e);
+ } catch (TokenStreamException e) {
+ throw new RuntimeException("Fatal IO error", e);
}
HeaderParser headerParser = new HeaderParser();
@@ -190,9 +186,7 @@ public class GlueGen implements GlueEmitterControls {
try {
emit = (GlueEmitter) Class.forName(emitterClass).newInstance();
} catch (Exception e) {
- System.err.println("Exception occurred while instantiating emitter class. Exiting.");
- e.printStackTrace();
- System.exit(1);
+ throw new RuntimeException("Exception occurred while instantiating emitter class.", e);
}
}
@@ -333,9 +327,7 @@ public class GlueGen implements GlueEmitterControls {
emit.endEmission();
} catch ( Exception e ) {
- e.printStackTrace();
- System.err.println("Exception occurred while generating glue code. Exiting.");
- System.exit(1);
+ throw new RuntimeException("Exception occurred while generating glue code.", e);
}
}