Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continue search on remaining files after error #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions src/us/deathmarine/luyten/FindAllBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,38 @@ public void run() {
if (entry.getName().endsWith(".class")) {
synchronized (settings) {
String internalName = StringUtilities.removeRight(entry.getName(), ".class");
TypeReference type = Model.metadataSystem.lookupType(internalName);
TypeDefinition resolvedType = null;
if (type == null || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type.");
TypeReference type = null;
try {
type = Model.metadataSystem.lookupType(internalName);
TypeDefinition resolvedType = null;
if (type != null && ((resolvedType = type.resolve()) != null)) {
StringWriter stringwriter = new StringWriter();
DecompilationOptions decompilationOptions;
decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(settings);
decompilationOptions.setFullDecompilation(true);
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(
decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(resolvedType, plainTextOutput,
decompilationOptions);
if (search(stringwriter.toString()))
addClassName(entry.getName());
}
} catch (IllegalStateException ise) {
if (ise.getMessage().toString().contains("Invalid BootstrapMethods attribute entry: 2 additional arguments required for method java/lang/invoke/StringConcatFactory.makeConcatWithConstants, but only 1 specified.")) {
// Known issue of Procyon <= 0.5.35 and fix not yet released, refer to https://bitbucket.org/mstrobel/procyon/issues/336/
// Searching in a WAR or JAR file could pop-up a lot of error dialogs for a lot of class files, we simply say nothing here
addClassName(entry.getName() + " (search failed due to known Exception in Procyon <= 0.5.35. Opening file will fail too)");
} else {
// all other IllegalStateException cases
addClassName(entry.getName() + " (search failed due to Exception. Opening file will fail too)");
Luyten.showExceptionDialog("Caught Exception on: " + entry.getName(), ise);
}
} catch (Exception e) {
addClassName(entry.getName() + " (search failed due to Exception. Opening file will fail too)");
Luyten.showExceptionDialog("Caught Exception on: " + entry.getName(), e);
}
StringWriter stringwriter = new StringWriter();
DecompilationOptions decompilationOptions;
decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(settings);
decompilationOptions.setFullDecompilation(true);
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(
decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(resolvedType, plainTextOutput,
decompilationOptions);
if (search(stringwriter.toString()))
addClassName(entry.getName());
}
} else {

Expand Down