StandardCharsets used where possible; try-with-resources used; cleanup
This commit is contained in:
@@ -9,6 +9,7 @@ import org.jetbrains.java.decompiler.main.extern.IResultSaver;
|
|||||||
import org.jetbrains.java.decompiler.util.InterpreterUtil;
|
import org.jetbrains.java.decompiler.util.InterpreterUtil;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
@@ -238,7 +239,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
|||||||
ZipOutputStream out = mapArchiveStreams.get(file);
|
ZipOutputStream out = mapArchiveStreams.get(file);
|
||||||
out.putNextEntry(new ZipEntry(entryName));
|
out.putNextEntry(new ZipEntry(entryName));
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
out.write(content.getBytes("UTF-8"));
|
out.write(content.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -106,7 +107,7 @@ public class DecompilerTestFixture {
|
|||||||
|
|
||||||
private static String getContent(File expected) {
|
private static String getContent(File expected) {
|
||||||
try {
|
try {
|
||||||
return new String(InterpreterUtil.getBytes(expected), "UTF-8").replace("\r\n", "\n");
|
return new String(InterpreterUtil.getBytes(expected), StandardCharsets.UTF_8).replace("\r\n", "\n");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user