summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-11-28 21:05:34 -0800
committerHarvey Harrison <[email protected]>2013-11-30 15:45:05 -0800
commitf87b0e53311cd15acfdbcf0ec73747eb57ebe22f (patch)
tree48d7d4d1d8b0e8885e5666bc0e580470ce4ee0c3
parent67dd9498368f0250180528d4fa10a09854066fea (diff)
gluegen: use String.format to emit the error exception in implementation classesv2.1.3
Changes emitted code from: if (__addr_ == 0) { throw new Exception("Method \"" + "$methodName" + "\" not available"); to: if (__addr == 0) { throw new Exception(String.format("Method \"%s\" not available", "$methodName")); This removes all the redundant error message parts for each error string and only stores the unique method name in a string. Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
index 407d58f..236627c 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
@@ -123,7 +123,8 @@ public class ProcAddressJavaMethodBindingEmitter extends JavaMethodBindingEmitte
String procAddressVariable = ProcAddressEmitter.PROCADDRESS_VAR_PREFIX + binding.getName();
writer.println(" final long __addr_ = " + getProcAddressTableExpr + "." + procAddressVariable + ";");
writer.println(" if (__addr_ == 0) {");
- writer.println(" throw new " + emitter.unsupportedExceptionType() + "(\"Method \\\"" + binding.getName() + "\\\" not available\");");
+ writer.format(" throw new %s(String.format(\"Method \\\"%%s\\\" not available\", \"%s\"));%n",
+ emitter.unsupportedExceptionType(), binding.getName());
writer.println(" }");
}
}