Updated the jar main to take the max log size as a param

Jonathan Bell [2012-08-17 03:52:41]
Updated the jar main to take the max log size as a param
Filename
Code/ChroniclerJ/META-INF/MANIFEST.MF
Code/ChroniclerJ/jar-descriptor.jardesc
Code/ChroniclerJ/makeJar.sh
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Constants.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/replay/NonDeterministicReplayMethodVisitor.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingClassVisitor.java
Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingMethodVisitor.java
Code/ChroniclerJ/unpackLibs.sh
chroniclerj-0.4.jar
diff --git a/Code/ChroniclerJ/META-INF/MANIFEST.MF b/Code/ChroniclerJ/META-INF/MANIFEST.MF
index 1591180..88ccc0b 100644
--- a/Code/ChroniclerJ/META-INF/MANIFEST.MF
+++ b/Code/ChroniclerJ/META-INF/MANIFEST.MF
@@ -1,5 +1,4 @@
 Manifest-Version: 1.0
 Created-By: 1.6.0_06 (Sun Microsystems Inc.)
 Main-Class: edu.columbia.cs.psl.chroniclerj.Main
-Class-Path: ./

diff --git a/Code/ChroniclerJ/jar-descriptor.jardesc b/Code/ChroniclerJ/jar-descriptor.jardesc
deleted file mode 100644
index 1ee0969..0000000
--- a/Code/ChroniclerJ/jar-descriptor.jardesc
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
-<jardesc>
-    <jar path="test case generation/chroniclerj.jar"/>
-    <options buildIfNeeded="true" compress="false" descriptionLocation="/test case generation/jar-descriptor.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
-    <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
-    <selectedProjects/>
-    <manifest generateManifest="false" manifestLocation="/test case generation/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
-        <sealing sealJar="false">
-            <packagesToSeal/>
-            <packagesToUnSeal/>
-        </sealing>
-    </manifest>
-    <selectedElements exportClassFiles="false" exportJavaFiles="false" exportOutputFolder="true">
-        <file path="/test case generation/lib/asm-all-4.0.jar"/>
-        <folder path="/test case generation/META-INF"/>
-        <file path="/test case generation/lib/xstream-1.4.2.jar"/>
-        <javaElement handleIdentifier="=test case generation/src"/>
-        <file path="/test case generation/lib/objenesis-1.2.jar"/>
-        <file path="/test case generation/lib/log4j-1.2.16.jar"/>
-        <file path="/test case generation/lib/kxml2-2.3.0.jar"/>
-    </selectedElements>
-</jardesc>
diff --git a/Code/ChroniclerJ/makeJar.sh b/Code/ChroniclerJ/makeJar.sh
new file mode 100644
index 0000000..0a1b8e7
--- /dev/null
+++ b/Code/ChroniclerJ/makeJar.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+jar cmf META-INF/MANIFEST.MF chroniclerj.jar META-INF/ listenerMethods.txt nondeterministic-methods.txt -C bin .
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 7ac83be..9160d6b 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java
@@ -39,7 +39,7 @@ public class ChroniclerJExportRunner extends Thread {
 		exportSerializable();
 		try {

-			File logFile = new File("chroniclerj-crash-"+System.currentTimeMillis());
+			File logFile = new File("chroniclerj-crash-"+System.currentTimeMillis()+".test");

 			Manifest manifest = new Manifest();
 			  manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
@@ -79,6 +79,8 @@ public class ChroniclerJExportRunner extends Thread {
 				}
 				is.close();
 				zos.closeEntry();
+				File f = new File(s);
+				f.delete();
 			}
 			for(String s : otherLogs)
 			{
@@ -94,6 +96,8 @@ public class ChroniclerJExportRunner extends Thread {
 				}
 				is.close();
 				zos.closeEntry();
+				File f = new File(s);
+				f.delete();
 			}
 			zos.flush();
 			zos.close();
@@ -141,7 +145,6 @@ public class ChroniclerJExportRunner extends Thread {

 	public static void export() {
 		shouldExport = 0;
-		System.out.println("Export");
 		try {
 			XStream xstream = new XStream(new StaticReflectionProvider());
 			String xml = "";
@@ -178,7 +181,6 @@ public class ChroniclerJExportRunner extends Thread {
 	public static void exportSerializable() {
 		shouldExportSerializable = 0;
 		try {
-			System.out.println("Export_s");

 			Log.logLock.lock();
 			{
@@ -250,7 +252,6 @@ public class ChroniclerJExportRunner extends Thread {
 			oos.flush();
 			oos.close();
 			ExportedLog.clearLog();
-			System.out.println("Export_s done");
 		} catch (Exception exi) {

 		}
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Constants.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Constants.java
index 2bce603..9f22bda 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Constants.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Constants.java
@@ -1,10 +1,9 @@
 package edu.columbia.cs.psl.chroniclerj;

-public interface Constants {
+public class Constants {

 	public static int DEFAULT_LOG_SIZE = 2000;
 	public static int MAX_LOG_SIZE = 40000000;
-	public static int VERY_MAX_LOG_SIZE = 400000000;

 	public static double LOG_GROWTH_RATE = 2.5;
 	public static String REPLAY_CLASS_SUFFIX = "InvivoReplay";
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 cc7ff24..79338b8 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java
@@ -1,30 +1,41 @@
 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 [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+			System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [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 [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+				System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
 				System.exit(-1);
 			}
-			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] = args[i];
+			int argOffset = 0;
+			if(args[1].startsWith("-mxLog"))
+			{
+				argOffset++;
+				Constants.MAX_LOG_SIZE=Integer.parseInt(args[1].replace("-mxLog", ""));
+			}
+			System.out.println("Offset " + argOffset);
+			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];
 			}
+			System.out.println(Arrays.deepToString(instrumenterArgs));
 			Instrumenter._main(instrumenterArgs);
-			Replayer._main(new String[] { args[1], args[3] });
+			Replayer._main(new String[] { args[1+argOffset], args[3+argOffset] });
 		}
 		else if(args[0].equals("-replay"))
 		{
@@ -44,7 +55,7 @@ public class Main {
 		}
 		else
 		{
-			System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
+			System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [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/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/replay/NonDeterministicReplayMethodVisitor.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/replay/NonDeterministicReplayMethodVisitor.java
index e225db7..392668c 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/replay/NonDeterministicReplayMethodVisitor.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/replay/NonDeterministicReplayMethodVisitor.java
@@ -15,7 +15,6 @@ import org.objectweb.asm.tree.MethodInsnNode;

 import edu.columbia.cs.psl.chroniclerj.CallbackRegistry;
 import edu.columbia.cs.psl.chroniclerj.ChroniclerJExportRunner;
-import edu.columbia.cs.psl.chroniclerj.Constants;
 import edu.columbia.cs.psl.chroniclerj.ExportedLog;
 import edu.columbia.cs.psl.chroniclerj.Instrumenter;
 import edu.columbia.cs.psl.chroniclerj.Log;
@@ -23,7 +22,7 @@ import edu.columbia.cs.psl.chroniclerj.MethodCall;
 import edu.columbia.cs.psl.chroniclerj.visitor.CloningAdviceAdapter;
 import edu.columbia.cs.psl.chroniclerj.visitor.NonDeterministicLoggingMethodVisitor;

-public class NonDeterministicReplayMethodVisitor extends CloningAdviceAdapter implements Constants {
+public class NonDeterministicReplayMethodVisitor extends CloningAdviceAdapter  {
 	private static Logger logger = Logger.getLogger(NonDeterministicReplayMethodVisitor.class);
 	private String name;
 	private String desc;
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingClassVisitor.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingClassVisitor.java
index 0e2393d..cf87b18 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingClassVisitor.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingClassVisitor.java
@@ -32,17 +32,16 @@ public class NonDeterministicLoggingClassVisitor extends ClassVisitor implements
 	public static HashSet<String> callbackMethods = new HashSet<String>();
 	static
 	{
-		File f = new File("listenerMethods.txt");
 		Scanner s;
 		try {
-			s = new Scanner(f);
+			s = new Scanner(NonDeterministicLoggingClassVisitor.class.getClassLoader().getResourceAsStream("listenerMethods.txt"));
 			while (s.hasNextLine())
 			{
 				String l = s.nextLine();
 				callbackMethods.add(l);
 				callbackClasses.add(l.substring(0,l.indexOf(".")));
 			}
-		} catch (FileNotFoundException e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
diff --git a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingMethodVisitor.java b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingMethodVisitor.java
index b0295f8..d4b2fb7 100644
--- a/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingMethodVisitor.java
+++ b/Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/visitor/NonDeterministicLoggingMethodVisitor.java
@@ -19,8 +19,9 @@ import org.objectweb.asm.tree.MethodInsnNode;
 import edu.columbia.cs.psl.chroniclerj.Constants;
 import edu.columbia.cs.psl.chroniclerj.Instrumenter;
 import edu.columbia.cs.psl.chroniclerj.MethodCall;
+import edu.columbia.cs.psl.chroniclerj.replay.NonDeterministicReplayMethodVisitor;

-public class NonDeterministicLoggingMethodVisitor extends CloningAdviceAdapter implements Constants {
+public class NonDeterministicLoggingMethodVisitor extends CloningAdviceAdapter {
 	private static Logger			logger					= Logger.getLogger(NonDeterministicLoggingMethodVisitor.class);
 	private String					name;
 	private String					desc;
@@ -40,13 +41,12 @@ public class NonDeterministicLoggingMethodVisitor extends CloningAdviceAdapter i
 		nonDeterministicMethods.add(owner + "." + name + ":" + desc);
 	}
 	static {
-		File f = new File("nondeterministic-methods.txt");
 		Scanner s;
 		try {
-			s = new Scanner(f);
+			s = new Scanner(NonDeterministicReplayMethodVisitor.class.getClassLoader().getResourceAsStream("nondeterministic-methods.txt"));
 			while (s.hasNextLine())
 				nonDeterministicMethods.add(s.nextLine());
-		} catch (FileNotFoundException e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
diff --git a/Code/ChroniclerJ/unpackLibs.sh b/Code/ChroniclerJ/unpackLibs.sh
new file mode 100644
index 0000000..ac1451a
--- /dev/null
+++ b/Code/ChroniclerJ/unpackLibs.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+cp lib/asm-all-4.0.jar bin/; cp lib/kxml2-2.3.0.jar bin/; cp lib/log4j-1.2.16.jar bin/; cp lib/objenesis-1.2.jar bin/; cp lib/xstream-1.4.2.jar bin/;
+cd bin
+unzip -n asm-all-4.0.jar; unzip -n kxml2-2.3.0.jar; unzip -n log4j-1.2.16.jar; unzip -n objenesis-1.2.jar; unzip -n xstream-1.4.2.jar
+rm asm-all-4.0.jar; rm kxml2-2.3.0.jar; rm log4j-1.2.16.jar; rm objenesis-1.2.jar; rm xstream-1.4.2.jar; rm -rf META-INF/
diff --git a/chroniclerj-0.4.jar b/chroniclerj-0.4.jar
index 47b42e8..889c186 100644
Binary files a/chroniclerj-0.4.jar and b/chroniclerj-0.4.jar differ