use of com.taobao.android.dx.cf.code.SimException in project atlas by alibaba.
the class Main method processOne.
/**
* Processes one pathname element.
*
* @param pathname {@code non-null;} the pathname to process. May
* be the path of a class file, a jar file, or a directory
* containing class files.
* @param filter {@code non-null;} A filter for excluding files.
*/
private void processOne(String pathname, FileNameFilter filter) {
ClassPathOpener opener;
opener = new ClassPathOpener(pathname, false, filter, new ClassPathOpener.Consumer() {
@Override
public boolean processFileBytes(String name, long lastModified, byte[] bytes) {
return Main.this.processFileBytes(name, lastModified, bytes);
}
@Override
public void onException(Exception ex) {
if (ex instanceof StopProcessing) {
throw (StopProcessing) ex;
} else if (ex instanceof SimException) {
dxConsole.err.println("\nEXCEPTION FROM SIMULATION:");
dxConsole.err.println(ex.getMessage() + "\n");
dxConsole.err.println(((SimException) ex).getContext());
} else {
dxConsole.err.println("\nUNEXPECTED TOP-LEVEL EXCEPTION:");
ex.printStackTrace(dxConsole.err);
}
errors.incrementAndGet();
}
@Override
public void onProcessArchiveStart(File file) {
if (args.verbose) {
dxConsole.out.println("processing archive " + file + "...");
}
}
});
if (args.numThreads > 1) {
parallelProcessorFutures.add(threadPool.submit(new ParallelProcessor(opener)));
} else {
if (opener.process()) {
anyFilesProcessed = true;
}
}
}
Aggregations