Skip to content

Commit

Permalink
With host classes, do not be fatal on faield BYTE command, as it may …
Browse files Browse the repository at this point in the history
…be system class
  • Loading branch information
judovana committed Dec 13, 2021
1 parent 4d9ab4d commit a79f0b4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jrd.backend.core.Logger;
import org.jrd.backend.core.VmDecompilerStatus;
import org.jrd.backend.data.Cli;
import org.jrd.backend.data.Config;
import org.jrd.backend.data.VmInfo;
import org.jrd.backend.data.VmManager;
import org.jrd.backend.decompiling.DecompilerWrapper;
Expand Down Expand Up @@ -51,7 +52,17 @@ public Collection<IdentifiedBytecode> getClass(ClassIdentifier... classIdentifie
Logger.getLogger().log(Logger.Level.DEBUG, "Init of class '" + clazz.getFullName() + "' failed, not obtaining.");
continue;
}
result = Cli.obtainClass(vmInfo, clazz.getFullName(), vmManager);
//if we are using host classes, the class may still by on host
if (Config.getConfig().doUseHostSystemClasses()) {
try {
result = Cli.obtainClass(vmInfo, clazz.getFullName(), vmManager);
} catch (Exception consumedExceptionOnUseHostClasses) {
Logger.getLogger().log(consumedExceptionOnUseHostClasses);
continue;
}
} else {
result = Cli.obtainClass(vmInfo, clazz.getFullName(), vmManager);
}
}
byte[] ba = Base64.getDecoder().decode(result.getLoadedClassBytes());
results.add(new IdentifiedBytecode(new ClassIdentifier(clazz.getFullName()), ba));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.jrd.frontend.frame.settings;

import org.jrd.frontend.frame.main.BytecodeDecompilerView;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
Expand All @@ -20,9 +23,20 @@ public CompilationSettingsPanel(boolean initialUseHostSystemClasses, String init
compilationSettingsLabel = new JLabel("Compilation settings");
useHostSystemClassesCheckBox =
new JCheckBox("Use host system classes during compilation phase of class overwrite", initialUseHostSystemClasses);
useHostSystemClassesCheckBox.setToolTipText(
BytecodeDecompilerView.styleTooltip() + "<b>very tricky switch</b><br>" +
"If true, then (should be default) then system classes (like java.lang) are loaded from THIS jvm<br>" +
"If false, then all classes are onl from remote vm. Where this is more correct, it slower and may have issues<br>" +
"Note, that even true, may bring some unexpected behavior, and is hard to determine what is better." +
" With false on FS, you have to provide also system classes to cp!"
);
compilerArgsLabel = new JLabel("Compiler arguments");
compilerArgsTextField = new JTextField(initialCompilerArgs);
compilerArgsTextField.setToolTipText("Arguments that get passed to the compiler, eg. '-source 5 -target 8 -release 9 -Xlint'.");
compilerArgsTextField.setToolTipText(
BytecodeDecompilerView.styleTooltip() +
"Arguments that get passed to the compiler, eg. '-source 5 -target 8 -release 9 -Xlint'."
);
compilerArgsLabel.setToolTipText(compilerArgsTextField.getToolTipText());

this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
Expand Down

0 comments on commit a79f0b4

Please sign in to comment.