mirror of
https://github.com/deathmarine/Luyten.git
synced 2024-11-23 12:49:40 +00:00
Added debugging output, Gracefully Handle Decompiler Issues.
Addresses Issue #60
This commit is contained in:
parent
cb5d4eb8c2
commit
40118fba2a
@ -107,6 +107,7 @@ public class FileSaver {
|
|||||||
bar.setVisible(true);
|
bar.setVisible(true);
|
||||||
setExtracting(true);
|
setExtracting(true);
|
||||||
label.setText("Extracting: " + outFile.getName());
|
label.setText("Extracting: " + outFile.getName());
|
||||||
|
System.out.println("[SaveAll]: "+inFile.getName()+" -> "+outFile.getName());
|
||||||
String inFileName = inFile.getName().toLowerCase();
|
String inFileName = inFile.getName().toLowerCase();
|
||||||
|
|
||||||
if (inFileName.endsWith(".jar") || inFileName.endsWith(".zip")) {
|
if (inFileName.endsWith(".jar") || inFileName.endsWith(".zip")) {
|
||||||
@ -175,6 +176,7 @@ public class FileSaver {
|
|||||||
if (entry.getName().endsWith(".class")) {
|
if (entry.getName().endsWith(".class")) {
|
||||||
JarEntry etn = new JarEntry(entry.getName().replace(".class", ".java"));
|
JarEntry etn = new JarEntry(entry.getName().replace(".class", ".java"));
|
||||||
label.setText("Extracting: " + etn.getName());
|
label.setText("Extracting: " + etn.getName());
|
||||||
|
System.out.println("[SaveAll]: "+etn.getName()+" -> "+outFile.getName());
|
||||||
|
|
||||||
if (history.add(etn.getName())) {
|
if (history.add(etn.getName())) {
|
||||||
out.putNextEntry(etn);
|
out.putNextEntry(etn);
|
||||||
@ -192,6 +194,10 @@ public class FileSaver {
|
|||||||
plainTextOutput.setUnicodeOutputEnabled(isUnicodeEnabled);
|
plainTextOutput.setUnicodeOutputEnabled(isUnicodeEnabled);
|
||||||
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
|
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
} catch(Exception e){
|
||||||
|
//e.printStackTrace();
|
||||||
|
label.setText("Cannot decompile file: " + entry.getName());
|
||||||
|
JOptionPane.showMessageDialog(null, "Unable to Decompile file!\n"+e.toString()+"\nSkipping file...", "Error!", JOptionPane.ERROR_MESSAGE);
|
||||||
} finally {
|
} finally {
|
||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
}
|
}
|
||||||
@ -250,6 +256,7 @@ public class FileSaver {
|
|||||||
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
|
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
|
||||||
String decompiledSource = stringwriter.toString();
|
String decompiledSource = stringwriter.toString();
|
||||||
|
|
||||||
|
System.out.println("[SaveAll]: "+inFile.getName()+" -> "+outFile.getName());
|
||||||
try (FileOutputStream fos = new FileOutputStream(outFile);
|
try (FileOutputStream fos = new FileOutputStream(outFile);
|
||||||
OutputStreamWriter writer = isUnicodeEnabled ? new OutputStreamWriter(fos, "UTF-8")
|
OutputStreamWriter writer = isUnicodeEnabled ? new OutputStreamWriter(fos, "UTF-8")
|
||||||
: new OutputStreamWriter(fos);
|
: new OutputStreamWriter(fos);
|
||||||
@ -261,6 +268,7 @@ public class FileSaver {
|
|||||||
|
|
||||||
private void doSaveUnknownFile(File inFile, File outFile) throws Exception {
|
private void doSaveUnknownFile(File inFile, File outFile) throws Exception {
|
||||||
try (FileInputStream in = new FileInputStream(inFile); FileOutputStream out = new FileOutputStream(outFile);) {
|
try (FileInputStream in = new FileInputStream(inFile); FileOutputStream out = new FileOutputStream(outFile);) {
|
||||||
|
System.out.println("[SaveAll]: "+inFile.getName()+" -> "+outFile.getName());
|
||||||
|
|
||||||
byte data[] = new byte[1024];
|
byte data[] = new byte[1024];
|
||||||
int count;
|
int count;
|
||||||
|
@ -141,6 +141,7 @@ public class MainWindow extends JFrame {
|
|||||||
public void onOpenFileMenu() {
|
public void onOpenFileMenu() {
|
||||||
File selectedFile = fileDialog.doOpenDialog();
|
File selectedFile = fileDialog.doOpenDialog();
|
||||||
if (selectedFile != null) {
|
if (selectedFile != null) {
|
||||||
|
System.out.println("[Open]: Opening "+ selectedFile.getAbsolutePath());
|
||||||
this.getModel().loadFile(selectedFile);
|
this.getModel().loadFile(selectedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user