diff options
author | Michael Bien <[email protected]> | 2010-04-01 02:49:47 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-04-01 02:49:47 +0200 |
commit | 11e70dff96d23708188bf1c8d7c3ffea3c110d43 (patch) | |
tree | 0fd40d695135f6af738d496dbba937188ee0ff18 /src/java | |
parent | 89b727b13ba35bd47a3b113c3ac3860950eeba0c (diff) |
fixed a bug introduced in commit 2fe517b9a2e1a680b50c7e1273897495800c5350 / hudson build 42.
Object local PrintWriter was used instead of method local after an attempt to prevent the
very same bug...
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/sun/gluegen/JavaEmitter.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index 240bb55..4cee09c 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -628,7 +628,7 @@ public class JavaEmitter implements GlueEmitter { cWriter(), cfg.implPackageName(), cfg.implClassName(), - true, // NOTE: we always disambiguate with a suffix now, so this is optional + true, // NOTE: we always disambiguate with a suffix now, so this is optional cfg.allStatic(), (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue), !cfg.nioDirectOnly(binding.getName()), @@ -846,6 +846,7 @@ public class JavaEmitter implements GlueEmitter { String structClassPkg = cfg.packageForStruct(name); PrintWriter writer = null; + PrintWriter newWriter = null; try { writer = openFile( cfg.javaOutputDir() + File.separator + @@ -857,9 +858,9 @@ public class JavaEmitter implements GlueEmitter { if (cfg.nativeOutputUsesJavaHierarchy()) { nRoot += File.separator + CodeGenUtils.packageAsPath(cfg.packageName()); } - PrintWriter newCWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); - CodeGenUtils.emitAutogeneratedWarning(newCWriter, this); - emitCHeader(newCWriter, containingTypeName); + newWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); + CodeGenUtils.emitAutogeneratedWarning(newWriter, this); + emitCHeader(newWriter, containingTypeName); } } catch(Exception e) { throw new RuntimeException("Unable to open files for emission of struct class", e); @@ -1008,7 +1009,7 @@ public class JavaEmitter implements GlueEmitter { // Emit (private) C entry point for calling this function pointer CMethodBindingEmitter cEmitter = new CMethodBindingEmitter(binding, - cWriter, + newWriter, structClassPkg, containingTypeName, true, // FIXME: this is optional at this point @@ -1163,8 +1164,8 @@ public class JavaEmitter implements GlueEmitter { writer.flush(); writer.close(); if (needsNativeCode) { - cWriter.flush(); - cWriter.close(); + newWriter.flush(); + newWriter.close(); } } public void endStructs() throws Exception {} |