Fixed minor issue that prevented logs from being exported in cases where only primitives (or nothing) is actually logged

Jonathan Bell [2012-12-02 17:45:51]
Fixed minor issue that prevented logs from being exported in cases where only primitives (or nothing) is actually logged
Filename
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
chroniclerj-0.4.1.jar
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
index 9160d6b..805a8ec 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
@@ -28,6 +28,7 @@ public class ChroniclerJExportRunner extends Thread {

 	public static void logMain(String main, String[] args)
 	{
+		CloningUtils.init();
 		mainClass = main;
 		mainArgs = new String[args.length];
 		System.arraycopy(args, 0, mainArgs, 0, args.length);
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java
index b3bea55..16268c0 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java
@@ -27,6 +27,18 @@ public class CloningUtils {
 	private static HashSet<Class<?>>	moreIgnoredImmutables;
 	private static HashSet<Class<?>>	nullInsteads;

+	private static boolean inited= false;
+	public static void init()
+	{
+		if(inited)
+			return;
+		inited=true;
+		ChroniclerJExportRunner.inst.start();
+		if (CATCH_ALL_ERRORS) {
+			Thread.setDefaultUncaughtExceptionHandler(new ChroniclerJUncaughtExceptionHandler());
+		}
+
+	}
 //	private static BufferedWriter		log;
 	static {
 		moreIgnoredImmutables = new HashSet<Class<?>>();
@@ -51,12 +63,9 @@ public class CloningUtils {
 		nullInsteads = new HashSet<Class<?>>();
 		nullInsteads.add(Permissions.class);
 		cloner.setExtraNullInsteadOfClone(nullInsteads);
+		init();
 //		cloner.setDumpClonedClasses(true);
-		ChroniclerJExportRunner.inst.start();
-		if (CATCH_ALL_ERRORS) {
-			Thread.setDefaultUncaughtExceptionHandler(new ChroniclerJUncaughtExceptionHandler());
-		}
-//		try {
+		//		try {
 //			File f = new File("cloneLog");
 //			if (f.exists())
 //				f.delete();
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
index 6fb2215..20e149c 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
@@ -1,39 +1,30 @@
 package edu.columbia.cs.psl.chroniclerj;

-import java.util.Arrays;
-
 import edu.columbia.cs.psl.chroniclerj.replay.ReplayRunner;
 import edu.columbia.cs.psl.chroniclerj.replay.Replayer;

 public class Main {
 	public static void main(String[] args) {
 		if (args.length < 1) {
-			System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+			System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
 			System.err.println("or");
 			System.err.println("Usage: java -jar chroniclerj.jar -replay [testcase]");
 			System.exit(-1);
 		}
 		if (args[0].equals("-instrument")) {
 			if (args.length < 4) {
-				System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+				System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
 				System.exit(-1);
 			}
-			int argOffset = 0;
-			if(args[1].startsWith("-mxLog"))
-			{
-				argOffset++;
-				Constants.MAX_LOG_SIZE=Integer.parseInt(args[1].replace("-mxLog", ""));
-			}
-			String[] instrumenterArgs = new String[args.length-1- argOffset];
-
-			instrumenterArgs[0] = args[1+argOffset];
-			instrumenterArgs[1] = args[2+argOffset];
-			instrumenterArgs[2] = args[1+argOffset];
-			for (int i = 4+argOffset; i < args.length; i++) {
-				instrumenterArgs[i-argOffset] = args[i];
+			String[] instrumenterArgs = new String[args.length-1];
+			instrumenterArgs[0] = args[1];
+			instrumenterArgs[1] = args[2];
+			instrumenterArgs[2] = args[1];
+			for (int i = 4; i < args.length; i++) {
+				instrumenterArgs[i-1] = args[i];
 			}
 			Instrumenter._main(instrumenterArgs);
-			Replayer._main(new String[] { args[1+argOffset], args[3+argOffset] });
+			Replayer._main(new String[] { args[1], args[3] });
 		}
 		else if(args[0].equals("-replay"))
 		{
@@ -53,7 +44,7 @@ public class Main {
 		}
 		else
 		{
-			System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+			System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
 			System.err.println("or");
 			System.err.println("Usage: java -jar chroniclerj.jar -replay [testcase]");
 			System.exit(-1);
diff --git a/chroniclerj-0.4.1.jar b/chroniclerj-0.4.1.jar
new file mode 100644
index 0000000..50a693f
Binary files /dev/null and b/chroniclerj-0.4.1.jar differ