Re: svn commit: r149313 - in jakarta/commons/sandbox/javaflow/trunk/src: java/org/apache/commons/javaflow/ java/org/apache/commons/javaflow/bytecode/bcel/ test/org/apache/commons/javaflow/ test/org/apache/commons/javaflow/testcode/

2005-02-01 Thread Torsten Curdt
Closing an OutputStream twice is a bug or is it indeed nitpicking? ;)
Bummer missed that one :)
That nitpicking was not aimed at your submission.
...it was on a new line on the commit message ;)
Well, the point is that the file writing code is
temporary anyway. I should go away in the near future.
That's why fixing it is not that important.
Btw: for some reason I've some problem applying
your patches with eclipse :-/ ...most of the
hunks are not being found.
I was thinking that it might make sense for me to work on some docs as
well... might be a good opportunity for me to dig deeper through things
as well as put down in words what I'm seeing and learn a few things from
you about the overall design.  Thoughts?
Sounds awesome!
cheers
--
Torsten


signature.asc
Description: OpenPGP digital signature


Re: svn commit: r149313 - in jakarta/commons/sandbox/javaflow/trunk/src: java/org/apache/commons/javaflow/ java/org/apache/commons/javaflow/bytecode/bcel/ test/org/apache/commons/javaflow/ test/org/apache/commons/javaflow/testcode/

2005-02-01 Thread WHIRLYCOTT
Torsten Curdt wrote:
Well, the point is that the file writing code is
temporary anyway. I should go away in the near future.
That's why fixing it is not that important.
Yes, I was going to ask about that one... can you let me in on your 
plans for this?  I agree that it should go away, but I haven't spent any 
time rethinking this.

Btw: for some reason I've some problem applying
your patches with eclipse :-/ ...most of the
hunks are not being found.
How goofy.  The subclipse client isn't as painfree as the cvs one from 
what I can tell.  The team synchronizing perspective occasionally 
indicates to me that there differences between local and remote when 
there are none.  I'm not sure what could cause this... will investigate.

phil.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


svn commit: r149313 - in jakarta/commons/sandbox/javaflow/trunk/src: java/org/apache/commons/javaflow/ java/org/apache/commons/javaflow/bytecode/bcel/ test/org/apache/commons/javaflow/ test/org/apache/commons/javaflow/testcode/

2005-01-31 Thread tcurdt
Author: tcurdt
Date: Mon Jan 31 14:53:31 2005
New Revision: 149313

URL: http://svn.apache.org/viewcvs?view=revrev=149313
Log:
improved the testcase as suggested by phil 
http://issues.apache.org/bugzilla/show_bug.cgi?id=33313
some nitpicking


Modified:

jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java

jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/ContinuationClassLoaderTestCase.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/ContinuationCompilingClassLoaderTestCase.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/testcode/Calculator.java

Modified: 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java?view=diffr1=149312r2=149313
==
--- 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
 (original)
+++ 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
 Mon Jan 31 14:53:31 2005
@@ -30,7 +30,7 @@
  *
  * @author a href=mailto:[EMAIL PROTECTED]Stephan Michels/a
  * @author a href=mailto:[EMAIL PROTECTED]Torsten Curdt/a
- * @version CVS $Id:$
+ * @version CVS $Id$
  */
 public class Continuation implements Serializable {
 
@@ -96,6 +96,7 @@
 final Method method = context.getMethod();
 
 try {
+
 method.invoke(instance, new Object[0]);
 
 } catch (final Exception e) {

Modified: 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java?view=diffr1=149312r2=149313
==
--- 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
 (original)
+++ 
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
 Mon Jan 31 14:53:31 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.javaflow.bytecode.bcel;
 
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Vector;
 
@@ -105,24 +106,46 @@
 final ClassGen clazzGen = new ClassGen(javaClazz);
 final ConstantPoolGen cp = clazzGen.getConstantPool();
 
-final String path = clazzGen.getClassName(); //.replace('.', '/');
+final String path = clazzGen.getClassName();
 
+FileOutputStream out = null;
+
 final byte[] orig = clazzGen.getJavaClass().getBytes();
 try {
-final FileOutputStream out = new FileOutputStream(path + .orig);
+out = new FileOutputStream(path + .orig);
 out.write(orig);
 out.flush();
 out.close();
-} catch (java.io.IOException ioe) {
-ioe.printStackTrace();
+} catch (final IOException e) {
+e.printStackTrace();
+
+try {
+if (out != null) {
+out.close();
+}
+} catch (final IOException e1) {
+log.error(e1.getMessage(), e1);
+} finally {
+out = null;
+}
 }
 
 try {
-final FileOutputStream fos = new FileOutputStream(path + 
.orig.java);
-final DecompilingVisitor v = new DecompilingVisitor(javaClazz, 
fos);
+out = new FileOutputStream(path + .orig.java);
+final DecompilingVisitor v = new DecompilingVisitor(javaClazz, 
out);
 v.start();
-} catch (Exception e) {
+} catch (final Exception e) {
 e.printStackTrace();
+
+try {
+if (out != null) {
+out.close();
+}
+} catch (final IOException e1) {
+log.error(e1.getMessage(), e1);
+} finally {
+out = null;
+}
 }
 
 // vistor to build the frame information
@@ -157,22 +180,42 @@
 
 clazzGen.addInterface(CONTINUATIONCAPABLE_CLASS);
 
-byte[] changed = clazzGen.getJavaClass().getBytes();
+final byte[] changed = clazzGen.getJavaClass().getBytes();
 try {
-java.io.FileOutputStream out = new 
java.io.FileOutputStream(clazzGen.getClassName() + .rewritten);
+out = new FileOutputStream(clazzGen.getClassName() + .rewritten);
 

Re: svn commit: r149313 - in jakarta/commons/sandbox/javaflow/trunk/src: java/org/apache/commons/javaflow/ java/org/apache/commons/javaflow/bytecode/bcel/ test/org/apache/commons/javaflow/ test/org/apache/commons/javaflow/testcode/

2005-01-31 Thread WHIRLYCOTT
Closing an OutputStream twice is a bug or is it indeed nitpicking? ;)
I was thinking that it might make sense for me to work on some docs as 
well... might be a good opportunity for me to dig deeper through things 
as well as put down in words what I'm seeing and learn a few things from 
you about the overall design.  Thoughts?

phil.
[EMAIL PROTECTED] wrote:
Author: tcurdt
Date: Mon Jan 31 14:53:31 2005
New Revision: 149313
URL: http://svn.apache.org/viewcvs?view=revrev=149313
Log:
improved the testcase as suggested by phil 
http://issues.apache.org/bugzilla/show_bug.cgi?id=33313
some nitpicking
Modified:

jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java

jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/ContinuationClassLoaderTestCase.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/ContinuationCompilingClassLoaderTestCase.java

jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/testcode/Calculator.java
Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java?view=diffr1=149312r2=149313
==
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java (original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java Mon Jan 31 14:53:31 2005
@@ -30,7 +30,7 @@
  *
  * @author a href=mailto:[EMAIL PROTECTED]Stephan Michels/a
  * @author a href=mailto:[EMAIL PROTECTED]Torsten Curdt/a
- * @version CVS $Id:$
+ * @version CVS $Id$
  */
 public class Continuation implements Serializable {
 
@@ -96,6 +96,7 @@
 final Method method = context.getMethod();
 
 try {
+
 method.invoke(instance, new Object[0]);
 
 } catch (final Exception e) {

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java?view=diffr1=149312r2=149313
==
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java (original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java Mon Jan 31 14:53:31 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.javaflow.bytecode.bcel;
 
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Vector;
 
@@ -105,24 +106,46 @@
 final ClassGen clazzGen = new ClassGen(javaClazz);
 final ConstantPoolGen cp = clazzGen.getConstantPool();
 
-final String path = clazzGen.getClassName(); //.replace('.', '/');
+final String path = clazzGen.getClassName();
 
+FileOutputStream out = null;
+
 final byte[] orig = clazzGen.getJavaClass().getBytes();
 try {
-final FileOutputStream out = new FileOutputStream(path + .orig);
+out = new FileOutputStream(path + .orig);
 out.write(orig);
 out.flush();
 out.close();
-} catch (java.io.IOException ioe) {
-ioe.printStackTrace();
+} catch (final IOException e) {
+e.printStackTrace();
+
+try {
+if (out != null) {
+out.close();
+}
+} catch (final IOException e1) {
+log.error(e1.getMessage(), e1);
+} finally {
+out = null;
+}
 }
 
 try {
-final FileOutputStream fos = new FileOutputStream(path + .orig.java);
-final DecompilingVisitor v = new DecompilingVisitor(javaClazz, fos);
+out = new FileOutputStream(path + .orig.java);
+final DecompilingVisitor v = new DecompilingVisitor(javaClazz, out);
 v.start();
-} catch (Exception e) {
+} catch (final Exception e) {
 e.printStackTrace();
+
+try {
+if (out != null) {
+out.close();
+}
+} catch (final IOException e1) {
+log.error(e1.getMessage(), e1);
+} finally {
+out = null;
+}
 }
 
 // vistor to build the frame information
@@ -157,22 +180,42 @@
 
 clazzGen.addInterface(CONTINUATIONCAPABLE_CLASS);
 
-byte[]