catch decompile errors (usually due to bad classpath); change output location reporting to occur earlier (in case there's an exception that terminates execution early).
@@ -198,6 +198,8 @@ public class MigrateJCas extends VoidVisitorAdapter<Object> {
new PrettyPrinterConfiguration();
static { printCu.setIndent(" "); }
+ private static final String ERROR_DECOMPILING = "!!! ERROR:";
+
/*****************
* Candidate
*****************/
@@ -426,6 +428,8 @@ public class MigrateJCas extends VoidVisitorAdapter<Object> {
void run(String[] args) {
CommandLineParser clp = parseCommandArgs(args);
+ System.out.format("Output top directory: %s%n", outputDirectory);
+
// clear output dir
FileUtils.deleteRecursive(new File(outputDirectory));
@@ -783,6 +787,18 @@ public class MigrateJCas extends VoidVisitorAdapter<Object> {
// System.out.println("Migrating source before migration:\n");
// System.out.println(source);
// System.out.println("\n\n\n");
+ if (source.startsWith(ERROR_DECOMPILING)) {
+ System.err.println("Decompiling failed, got: " + source);
+ System.err.println("Please check the migrateClasspath");
+ System.err.println(" argument was: " + migrateClasspath);
+ System.err.println(" Value used was:");
+ URL[] urls = Misc.classpath2urls(migrateClasspath);
+ for (URL url : urls) {
+ System.err.println(" " + url.toString());
+ }
+ System.err.println("Skipping this component");
+ return;
+ }
StringReader sr = new StringReader(source);
try {
@@ -829,6 +845,7 @@ public class MigrateJCas extends VoidVisitorAdapter<Object> {
System.out.print("d");
}
} catch (IOException e) {
+ e.printStackTrace();
throw new RuntimeException(e);
}
} else {
