Skip to content

Commit 0113c98

Browse files
committed
Fixed minor issue that prevented logs from being exported in cases where only primitives (or nothing) is actually logged
1 parent a9014ed commit 0113c98

4 files changed

Lines changed: 25 additions & 24 deletions

File tree

Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/ChroniclerJExportRunner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class ChroniclerJExportRunner extends Thread {
2828

2929
public static void logMain(String main, String[] args)
3030
{
31+
CloningUtils.init();
3132
mainClass = main;
3233
mainArgs = new String[args.length];
3334
System.arraycopy(args, 0, mainArgs, 0, args.length);

Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/CloningUtils.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ public class CloningUtils {
2727
private static HashSet<Class<?>> moreIgnoredImmutables;
2828
private static HashSet<Class<?>> nullInsteads;
2929

30+
private static boolean inited= false;
31+
public static void init()
32+
{
33+
if(inited)
34+
return;
35+
inited=true;
36+
ChroniclerJExportRunner.inst.start();
37+
if (CATCH_ALL_ERRORS) {
38+
Thread.setDefaultUncaughtExceptionHandler(new ChroniclerJUncaughtExceptionHandler());
39+
}
40+
41+
}
3042
// private static BufferedWriter log;
3143
static {
3244
moreIgnoredImmutables = new HashSet<Class<?>>();
@@ -51,12 +63,9 @@ public class CloningUtils {
5163
nullInsteads = new HashSet<Class<?>>();
5264
nullInsteads.add(Permissions.class);
5365
cloner.setExtraNullInsteadOfClone(nullInsteads);
66+
init();
5467
// cloner.setDumpClonedClasses(true);
55-
ChroniclerJExportRunner.inst.start();
56-
if (CATCH_ALL_ERRORS) {
57-
Thread.setDefaultUncaughtExceptionHandler(new ChroniclerJUncaughtExceptionHandler());
58-
}
59-
// try {
68+
// try {
6069
// File f = new File("cloneLog");
6170
// if (f.exists())
6271
// f.delete();

Code/ChroniclerJ/src/edu/columbia/cs/psl/chroniclerj/Main.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,30 @@
11
package edu.columbia.cs.psl.chroniclerj;
22

3-
import java.util.Arrays;
4-
53
import edu.columbia.cs.psl.chroniclerj.replay.ReplayRunner;
64
import edu.columbia.cs.psl.chroniclerj.replay.Replayer;
75

86
public class Main {
97
public static void main(String[] args) {
108
if (args.length < 1) {
11-
System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
9+
System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
1210
System.err.println("or");
1311
System.err.println("Usage: java -jar chroniclerj.jar -replay [testcase]");
1412
System.exit(-1);
1513
}
1614
if (args[0].equals("-instrument")) {
1715
if (args.length < 4) {
18-
System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
16+
System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
1917
System.exit(-1);
2018
}
21-
int argOffset = 0;
22-
if(args[1].startsWith("-mxLog"))
23-
{
24-
argOffset++;
25-
Constants.MAX_LOG_SIZE=Integer.parseInt(args[1].replace("-mxLog", ""));
26-
}
27-
String[] instrumenterArgs = new String[args.length-1- argOffset];
28-
29-
instrumenterArgs[0] = args[1+argOffset];
30-
instrumenterArgs[1] = args[2+argOffset];
31-
instrumenterArgs[2] = args[1+argOffset];
32-
for (int i = 4+argOffset; i < args.length; i++) {
33-
instrumenterArgs[i-argOffset] = args[i];
19+
String[] instrumenterArgs = new String[args.length-1];
20+
instrumenterArgs[0] = args[1];
21+
instrumenterArgs[1] = args[2];
22+
instrumenterArgs[2] = args[1];
23+
for (int i = 4; i < args.length; i++) {
24+
instrumenterArgs[i-1] = args[i];
3425
}
3526
Instrumenter._main(instrumenterArgs);
36-
Replayer._main(new String[] { args[1+argOffset], args[3+argOffset] });
27+
Replayer._main(new String[] { args[1], args[3] });
3728
}
3829
else if(args[0].equals("-replay"))
3930
{
@@ -53,7 +44,7 @@ else if(args[0].equals("-replay"))
5344
}
5445
else
5546
{
56-
System.err.println("Usage: java -jar chroniclerj.jar -instrument {-mxLogN} [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
47+
System.err.println("Usage: java -jar chroniclerj.jar -instrument [source] [dest-deploy] [dest-replay] {additional-classpath-entries}");
5748
System.err.println("or");
5849
System.err.println("Usage: java -jar chroniclerj.jar -replay [testcase]");
5950
System.exit(-1);

chroniclerj-0.4.1.jar

3.74 MB
Binary file not shown.

0 commit comments

Comments
 (0)