fixed the NPE from prev commit

Jonathan Bell [2012-03-21 21:36:28]
fixed the NPE from prev commit
Filename
Columbus2Tester/columbus2.log
Columbus2Tester/src/edu/columbia/cs/psl/metamorphic/example/ProcessorTester.java
columbus2/src/edu/columbia/cs/psl/metamorphic/runtime/Interceptor.java
columbus2/src/edu/columbia/cs/psl/metamorphic/struct/MetamorphicMethodInvocation.java
diff --git a/Columbus2Tester/columbus2.log b/Columbus2Tester/columbus2.log
index 8dc34f0..4cbf22a 100644
--- a/Columbus2Tester/columbus2.log
+++ b/Columbus2Tester/columbus2.log
@@ -570,3 +570,19 @@
 [columbus2 - main (2012-03-21 14:55:09,355)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.ProcessorTester
 [columbus2 - main (2012-03-21 14:55:15,174)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.ProcessorTester
 [columbus2 - main (2012-03-21 14:55:15,598)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:02:45,582)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:03:18,766)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:06:23,818)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:06:34,729)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:06:41,693)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:07:04,903)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:08:26,725)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:08:30,610)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:08:42,962)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:08:45,632)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:09:22,115)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:09:58,717)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.ProcessorTester
+[columbus2 - main (2012-03-21 17:10:16,637)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.ProcessorTester
+[columbus2 - main (2012-03-21 17:10:16,760)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
+[columbus2 - main (2012-03-21 17:36:08,229)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.ProcessorTester
+[columbus2 - main (2012-03-21 17:36:08,371)] INFO edu.columbia.cs.psl.invivo.runtime.visitor.InterceptingClassVisitor.visitEnd(57) | Actually rewroteedu.columbia.cs.psl.metamorphic.example.SimpleExample
diff --git a/Columbus2Tester/src/edu/columbia/cs/psl/metamorphic/example/ProcessorTester.java b/Columbus2Tester/src/edu/columbia/cs/psl/metamorphic/example/ProcessorTester.java
index 2ba2fa3..8c1f279 100644
--- a/Columbus2Tester/src/edu/columbia/cs/psl/metamorphic/example/ProcessorTester.java
+++ b/Columbus2Tester/src/edu/columbia/cs/psl/metamorphic/example/ProcessorTester.java
@@ -37,6 +37,9 @@ public class ProcessorTester {
 	// this will give an error if the array is empty, but whatever... =)
 	return values[closestIndex];
   }
+
+//    private static String[] myStuff = new String[] {"d","e","f"};
+//    private static String[] myStuff_2 = new String[] {"d","e","f"};
     @Metamorphic(rules = {
     		@Rule(test = "pickFirstString(\\Shuffle(in))", check="\\result")})
     private String pickFirstString(String[] in)
diff --git a/columbus2/src/edu/columbia/cs/psl/metamorphic/runtime/Interceptor.java b/columbus2/src/edu/columbia/cs/psl/metamorphic/runtime/Interceptor.java
index 9c79bd8..8ab2651 100644
--- a/columbus2/src/edu/columbia/cs/psl/metamorphic/runtime/Interceptor.java
+++ b/columbus2/src/edu/columbia/cs/psl/metamorphic/runtime/Interceptor.java
@@ -1,14 +1,12 @@
 package edu.columbia.cs.psl.metamorphic.runtime;

-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;

-import org.apache.log4j.Logger;

-import com.rits.cloning.Cloner;

 import edu.columbia.cs.psl.invivo.runtime.AbstractInterceptor;
+import edu.columbia.cs.psl.invivo.struct.MethodInvocation;
 import edu.columbia.cs.psl.metamorphic.runtime.annotation.Metamorphic;
 import edu.columbia.cs.psl.metamorphic.runtime.annotation.Rule;
 import edu.columbia.cs.psl.metamorphic.struct.MetamorphicMethodInvocation;
@@ -28,7 +26,6 @@ public class Interceptor extends AbstractInterceptor {
 	private Integer invocationId = 0;
 	private Class<?> testerClass;

-	private Logger logger = Logger.getLogger(Interceptor.class);
 	public Interceptor(Object intercepted) {
 		super(intercepted);
 		try {
@@ -39,7 +36,6 @@ public class Interceptor extends AbstractInterceptor {
 			e.printStackTrace();
 		}
 	}
-	private Cloner cloner = new Cloner();
 	public int onEnter(Object callee, Method method, Object[] params)
 	{
 		if(isChild(callee))
@@ -80,17 +76,14 @@ public class Interceptor extends AbstractInterceptor {
 		childTestParamTypes[params.length] = callee.getClass();
 		childTestParamTypes[params.length+1] = Method.class;

-
-
-
 		invocations.put(retId, inv);
+
 		inv.children = new MetamorphicMethodInvocation[rules.length];
 		for(int i = 0; i < rules.length;i++)
 		{
-			final int k = i;
 			inv.children[i] = new MetamorphicMethodInvocation();
 			inv.children[i].parent = inv;
-			inv.children[i].rule = rules[i];
+			((MetamorphicMethodInvocation) inv.children[i]).rule = rules[i];
 			try {
 				inv.children[i].method = getMethod(inv.method.getName()+"_"+i, childTestParamTypes,testerClass);
 				inv.children[i].checkMethod = getMethod(inv.method.getName()+"_Check"+i, checkTypes,testerClass);
@@ -119,14 +112,14 @@ public class Interceptor extends AbstractInterceptor {
 		Object[] checkParams = new Object[inv.params.length + 2];
 		for(int i =0;i<inv.params.length;i++)
 			checkParams[i+2] = inv.params_cloned[i];
-		for(MetamorphicMethodInvocation i : inv.children)
+		for(MethodInvocation i : inv.children)
 		{
 			i.thread.join();
 			checkParams[0] = val;
 			checkParams[1] = i.returnValue;
 			if(((Boolean)i.checkMethod.invoke(null, checkParams)) == false)
 			{
-				throw new IllegalStateException("Metamorphic property has been violated on " + inv.method +". Rule: [" + i.rule +"]. Outputs were [" + val+"], ["+i.returnValue+"]");
+				throw new IllegalStateException("Metamorphic property has been violated on " + inv.method +". Rule: [" + ((MetamorphicMethodInvocation) i).rule +"]. Outputs were [" + val+"], ["+i.returnValue+"]");
 			}
 		}
 		System.out.println("Invocation result: " + inv);
diff --git a/columbus2/src/edu/columbia/cs/psl/metamorphic/struct/MetamorphicMethodInvocation.java b/columbus2/src/edu/columbia/cs/psl/metamorphic/struct/MetamorphicMethodInvocation.java
index 1d7aff2..3424d48 100644
--- a/columbus2/src/edu/columbia/cs/psl/metamorphic/struct/MetamorphicMethodInvocation.java
+++ b/columbus2/src/edu/columbia/cs/psl/metamorphic/struct/MetamorphicMethodInvocation.java
@@ -1,6 +1,5 @@
 package edu.columbia.cs.psl.metamorphic.struct;

-import java.lang.reflect.Method;

 import edu.columbia.cs.psl.invivo.struct.MethodInvocation;
 import edu.columbia.cs.psl.metamorphic.runtime.annotation.Rule;
@@ -11,15 +10,7 @@ public class MetamorphicMethodInvocation extends MethodInvocation
 	 *
 	 */
 	private static final long serialVersionUID = -2038681047970130055L;
-	public Object callee;
-	public Method method;
-	public Object[] params;
-	public Object[] params_cloned;
-	public Object returnValue;
-	public Exception thrownExceptions;
-	public Thread thread;
-	public MetamorphicMethodInvocation[] children;
-	public Method checkMethod;
+
 	public Rule rule;

 	@Override
@@ -33,7 +24,7 @@ public class MetamorphicMethodInvocation extends MethodInvocation
 		}
 		String childStr = "";
 		if(children != null)
-			for(MetamorphicMethodInvocation i : children)
+			for(MethodInvocation i : children)
 				childStr += i.toString() +",";
 		return "[Invocation on method "+ (method == null ? "null" : method.getName()) + " with params " + paramStr + " returning " + returnValue +" on object " + callee +".  Children: ["+childStr+"] ]";
 	}