You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by tc...@apache.org on 2005/01/12 23:28:03 UTC
cvs commit: jakarta-commons-sandbox/javaflow .classpath
tcurdt 2005/01/12 14:28:03
Modified: javaflow/src/java/org/apache/javaflow
ContinuationClassTransformer.java
RewritingResourceStore.java Continuation.java
TestClassLoader.java ContinuationStack.java
javaflow/src/java/org/apache/javaflow/analyser
LocalVariables.java
javaflow .classpath
Log:
use commons-logging
Revision Changes Path
1.2 +6 -2 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/ContinuationClassTransformer.java
Index: ContinuationClassTransformer.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/ContinuationClassTransformer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContinuationClassTransformer.java 3 Jan 2005 23:54:17 -0000 1.1
+++ ContinuationClassTransformer.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -56,6 +56,8 @@
import org.apache.bcel.generic.TargetLostException;
import org.apache.bcel.generic.Type;
import org.apache.bcel.verifier.exc.AssertionViolatedException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.javaflow.analyser.ControlFlowGraph;
import org.apache.javaflow.analyser.ExceptionHandler;
import org.apache.javaflow.analyser.ExecutionVisitor;
@@ -72,6 +74,8 @@
*/
public final class ContinuationClassTransformer implements ClassTransformer {
+ private final static Log log = LogFactory.getLog(ContinuationClassTransformer.class);
+
private static final String CONTINUATION_CLASS = Continuation.class.getName();
private static final ObjectType CONTINUATION_TYPE = new ObjectType(CONTINUATION_CLASS);
private static final String STACK_CLASS = ContinuationStack.class.getName();
@@ -89,7 +93,7 @@
private boolean debug = true;
public byte[] transform(final JavaClass javaClazz) {
- System.out.println("transforming class " + javaClazz.getClassName());
+ log.debug("transforming class " + javaClazz.getClassName());
final ClassGen clazz = new ClassGen(javaClazz);
final ConstantPoolGen cp = clazz.getConstantPool();
@@ -180,7 +184,7 @@
//private void analyse(ClassGen clazz, MethodGen method, ControlFlowGraph cfg, InstConstraintVisitor icv, ExecutionVisitor ev) {
private void analyse(ClassGen clazz, MethodGen method, ControlFlowGraph cfg, ExecutionVisitor ev) {
- System.out.println("analyse " + method.getName());
+ log.debug("analyse " + method.getName());
// build the initial frame situation for this method.
Frame vanillaFrame = new Frame(method.getMaxLocals(), method.getMaxStack());
1.2 +9 -5 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/RewritingResourceStore.java
Index: RewritingResourceStore.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/RewritingResourceStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RewritingResourceStore.java 3 Jan 2005 23:54:17 -0000 1.1
+++ RewritingResourceStore.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -26,6 +26,8 @@
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.util.ClassLoaderRepository;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.jci.stores.ResourceStore;
import org.apache.jci.stores.TransactionalResourceStore;
@@ -35,7 +37,9 @@
*/
public class RewritingResourceStore extends TransactionalResourceStore {
- final private Collection changes = new ArrayList();
+ private final static Log log = LogFactory.getLog(RewritingResourceStore.class);
+
+ private final Collection changes = new ArrayList();
public RewritingResourceStore(final ResourceStore pStore) {
super(pStore);
@@ -54,12 +58,12 @@
try {
final InputStream is = new ByteArrayInputStream(resourceData);
- System.out.println("parsing " + resourceName);
+ log.debug("parsing " + resourceName);
final ClassParser parser = new ClassParser(is, resourceName);
final JavaClass clazz = parser.parse();
- System.out.println("saving " + resourceName + " class information in BCEL repository");
+ log.debug("saving " + resourceName + " class information in BCEL repository");
Repository.addClass(clazz);
@@ -70,7 +74,7 @@
public void onStop() {
if (changes.size() > 0) {
- System.out.println("rewriting" + changes);
+ log.debug("rewriting" + changes);
final ClassTransformer transformer = new ContinuationClassTransformer();
@@ -80,7 +84,7 @@
final JavaClass clazz = Repository.lookupClass(clazzName);
final byte[] clazzBytes = transformer.transform(clazz);
super.write(clazzName, clazzBytes);
- System.out.println("rewrote " + clazzName);
+ log.debug("rewrote " + clazzName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
1.2 +9 -2 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/Continuation.java
Index: Continuation.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/Continuation.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Continuation.java 3 Jan 2005 23:54:17 -0000 1.1
+++ Continuation.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -17,6 +17,9 @@
import java.util.HashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* Continations object to store the current execution. The contiunation
* object can only used once.
@@ -26,6 +29,10 @@
* @version CVS $Id$
*/
public class Continuation {
+
+ private final static Log log = LogFactory.getLog(Continuation.class);
+
+
private ContinuationStack stack;
private Object context;
@@ -73,7 +80,7 @@
*/
public static void suspend() {
- System.out.println("suspend()");
+ log.debug("suspend()");
Continuation continuation = Continuation.currentContinuation();
1.2 +5 -2 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/TestClassLoader.java
Index: TestClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/TestClassLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestClassLoader.java 3 Jan 2005 23:54:17 -0000 1.1
+++ TestClassLoader.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -17,6 +17,8 @@
import java.io.File;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.jci.CompilingClassLoader;
@@ -25,6 +27,7 @@
*
*/
public final class TestClassLoader {
+ private final static Log log = LogFactory.getLog(TestClassLoader.class);
private void testReloading() throws Exception {
final CompilingClassLoader cl = new ContinuationClassLoader(
@@ -39,9 +42,9 @@
final Class clazz = cl.loadClass("org.vafer.Test");
final Main test = (Main) clazz.newInstance();
test.main();
- System.out.println("ok");
+ log.debug("ok");
} catch (ClassNotFoundException e) {
- System.out.println("error");
+ log.debug("error");
}
Thread.sleep(2000);
1.2 +18 -13 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/ContinuationStack.java
Index: ContinuationStack.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/ContinuationStack.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContinuationStack.java 3 Jan 2005 23:54:17 -0000 1.1
+++ ContinuationStack.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -15,6 +15,9 @@
*/
package org.apache.javaflow;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* Stack to store the frame information along the invocation trace.
*
@@ -24,6 +27,8 @@
*/
public class ContinuationStack implements java.io.Serializable {
+ private final static Log log = LogFactory.getLog(ContinuationStack.class);
+
private static final long serialVersionUID = 1L;
private int[] istack;
@@ -68,7 +73,7 @@
if (dTop==0)
throw new EmptyStackException("pop double");
double d = dstack[--dTop];
- System.out.println("pop double "+d+" "+toString());
+ log.debug("pop double "+d+" "+toString());
return d;
}
@@ -76,7 +81,7 @@
if (fTop==0)
throw new EmptyStackException("pop float");
float f = fstack[--fTop];
- System.out.println("pop float "+f+" "+toString());
+ log.debug("pop float "+f+" "+toString());
return f;
}
@@ -84,7 +89,7 @@
if (iTop==0)
throw new EmptyStackException("pop int");
int i = istack[--iTop];
- System.out.println("pop int "+i+" "+toString());
+ log.debug("pop int "+i+" "+toString());
return i;
}
@@ -92,7 +97,7 @@
if (lTop==0)
throw new EmptyStackException("pop long");
long l = lstack[--lTop];
- System.out.println("pop long "+l+" "+toString());
+ log.debug("pop long "+l+" "+toString());
return l;
}
@@ -100,7 +105,7 @@
if (oTop==0)
throw new EmptyStackException("pop object");
Object o = ostack[--oTop];
- System.out.println("pop object "+ o.getClass().getName() + " " + o + " " + toString());
+ log.debug("pop object "+ o.getClass().getName() + " " + o + " " + toString());
return o;
}
@@ -108,12 +113,12 @@
if (rTop==0)
throw new EmptyStackException("pop reference");
Object o = rstack[--rTop];
- System.out.println("pop reference "+ o.getClass().getName() + " " + o + " " + toString());
+ log.debug("pop reference "+ o.getClass().getName() + " " + o + " " + toString());
return o;
}
public void pushDouble(double d) {
- System.out.println("push double "+d+" "+toString());
+ log.debug("push double "+d+" "+toString());
dstack[dTop++] = d;
if (dTop == dstack.length) {
double[] hlp = new double[dstack.length + 10];
@@ -123,7 +128,7 @@
}
public void pushFloat(float f) {
- System.out.println("push float "+f+" "+toString());
+ log.debug("push float "+f+" "+toString());
fstack[fTop++] = f;
if (fTop == fstack.length) {
float[] hlp = new float[fstack.length + 10];
@@ -133,7 +138,7 @@
}
public void pushInt(int i) {
- System.out.println("push int "+i+" "+toString());
+ log.debug("push int "+i+" "+toString());
istack[iTop++] = i;
if (iTop == istack.length) {
int[] hlp = new int[istack.length + 10];
@@ -143,7 +148,7 @@
}
public void pushLong(long l) {
- System.out.println("push long "+l+" "+toString());
+ log.debug("push long "+l+" "+toString());
lstack[lTop++] = l;
if (lTop == lstack.length) {
long[] hlp = new long[lstack.length + 10];
@@ -153,7 +158,7 @@
}
public void pushObject(Object o) {
- System.out.println("push object " + o.getClass().getName() + " " + o + " " + toString());
+ log.debug("push object " + o.getClass().getName() + " " + o + " " + toString());
ostack[oTop++] = o;
if (oTop == ostack.length) {
Object[] hlp = new Object[ostack.length + 10];
@@ -163,7 +168,7 @@
}
public void pushReference(Object o) {
- System.out.println("push reference " + o.getClass().getName() + " " + o + " " + toString());
+ log.debug("push reference " + o.getClass().getName() + " " + o + " " + toString());
rstack[rTop++] = o;
if (rTop == rstack.length) {
Object[] hlp = new Object[rstack.length + 10];
1.2 +2 -2 jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/analyser/LocalVariables.java
Index: LocalVariables.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/src/java/org/apache/javaflow/analyser/LocalVariables.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalVariables.java 3 Jan 2005 23:54:18 -0000 1.1
+++ LocalVariables.java 12 Jan 2005 22:28:03 -0000 1.2
@@ -97,7 +97,7 @@
if (this.locals.length != lv.locals.length) return false;
for (int i=0; i<this.locals.length; i++){
if (!this.locals[i].equals(lv.locals[i])){
- //System.out.println(this.locals[i]+" is not "+lv.locals[i]);
+ //log.debug(this.locals[i]+" is not "+lv.locals[i]);
return false;
}
}
1.2 +2 -0 jakarta-commons-sandbox/javaflow/.classpath
Index: .classpath
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/javaflow/.classpath,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .classpath 3 Jan 2005 23:54:17 -0000 1.1
+++ .classpath 12 Jan 2005 22:28:03 -0000 1.2
@@ -4,5 +4,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry sourcepath="/home/tcurdt/dev/jakarta-bcel-trunk/src/java" kind="lib" path="lib/jakarta-bcel-20040329.jar"/>
<classpathentry kind="src" path="/jci"/>
+ <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-api-1.0.4.jar"/>
+ <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org