Fix closed stream for Procyon

This commit is contained in:
Nico Mexis 2021-11-18 12:46:42 +01:00
parent 713edc016e
commit 1f009d5c69
No known key found for this signature in database
GPG Key ID: 27D6E17CE092AB78
1 changed files with 14 additions and 14 deletions

View File

@ -68,10 +68,9 @@ import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.PRO
* @author Konloch * @author Konloch
* @author DeathMarine * @author DeathMarine
*/ */
public class ProcyonDecompiler extends InternalDecompiler public class ProcyonDecompiler extends InternalDecompiler {
{
public DecompilerSettings getDecompilerSettings() public DecompilerSettings getDecompilerSettings() {
{
DecompilerSettings settings = new DecompilerSettings(); DecompilerSettings settings = new DecompilerSettings();
settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.alwaysGenerateExceptionVars.isSelected()); settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.alwaysGenerateExceptionVars.isSelected());
settings.setExcludeNestedTypes(BytecodeViewer.viewer.excludeNestedTypes.isSelected()); settings.setExcludeNestedTypes(BytecodeViewer.viewer.excludeNestedTypes.isSelected());
@ -184,12 +183,11 @@ public class ProcyonDecompiler extends InternalDecompiler
|| ((resolvedType = type.resolve()) == null)) { || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type."); throw new Exception("Unable to resolve type.");
} }
try (Writer writer = new OutputStreamWriter(out)) { Writer writer = new OutputStreamWriter(out);
settings.getLanguage().decompileType(resolvedType, settings.getLanguage().decompileType(resolvedType,
new PlainTextOutput(writer), new PlainTextOutput(writer),
decompilationOptions); decompilationOptions);
writer.flush(); writer.flush();
}
} finally { } finally {
out.closeEntry(); out.closeEntry();
} }
@ -212,8 +210,7 @@ public class ProcyonDecompiler extends InternalDecompiler
out.closeEntry(); out.closeEntry();
} }
} catch (ZipException ze) { } catch (ZipException ze) {
// some jar-s contain duplicate pom.xml entries: ignore // some jars contain duplicate pom.xml entries: ignore it
// it
if (!ze.getMessage().contains("duplicate")) { if (!ze.getMessage().contains("duplicate")) {
throw ze; throw ze;
} }
@ -227,6 +224,7 @@ public class ProcyonDecompiler extends InternalDecompiler
* @author DeathMarine * @author DeathMarine
*/ */
public static final class LuytenTypeLoader implements ITypeLoader { public static final class LuytenTypeLoader implements ITypeLoader {
private final List<ITypeLoader> _typeLoaders; private final List<ITypeLoader> _typeLoaders;
public LuytenTypeLoader() { public LuytenTypeLoader() {
@ -251,5 +249,7 @@ public class ProcyonDecompiler extends InternalDecompiler
return false; return false;
} }
} }
} }