refactor: fix several issues reported by sonar
This commit is contained in:
@@ -91,12 +91,7 @@ public class ConstStorage {
|
||||
}
|
||||
|
||||
private ValueStorage getClsValues(ClassNode cls) {
|
||||
ValueStorage classValues = classes.get(cls);
|
||||
if (classValues == null) {
|
||||
classValues = new ValueStorage();
|
||||
classes.put(cls, classValues);
|
||||
}
|
||||
return classValues;
|
||||
return classes.computeIfAbsent(cls, c -> new ValueStorage());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,8 +16,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import jadx.core.utils.exceptions.JadxRuntimeException;
|
||||
|
||||
import static jadx.core.utils.files.FileUtils.close;
|
||||
|
||||
/**
|
||||
* Simple template engine
|
||||
* Syntax for replace variable with value: '{{variable}}'
|
||||
@@ -56,21 +54,15 @@ public class TemplateFile {
|
||||
}
|
||||
|
||||
public String build() throws IOException {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try {
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
process(out);
|
||||
} finally {
|
||||
close(out);
|
||||
return out.toString();
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
public void save(File outFile) throws IOException {
|
||||
OutputStream out = new FileOutputStream(outFile);
|
||||
try {
|
||||
try (OutputStream out = new FileOutputStream(outFile)) {
|
||||
process(out);
|
||||
} finally {
|
||||
close(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
@@ -92,9 +93,8 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
public static void deleteDir(Path dir) {
|
||||
try {
|
||||
Files.walk(dir)
|
||||
.sorted(Comparator.reverseOrder())
|
||||
try (Stream<Path> pathStream = Files.walk(dir)) {
|
||||
pathStream.sorted(Comparator.reverseOrder())
|
||||
.map(Path::toFile)
|
||||
.forEach(File::delete);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -40,7 +40,6 @@ class SearchBar extends JToolBar {
|
||||
|
||||
private final JCheckBox wholeWordCB;
|
||||
private final JCheckBox matchCaseCB;
|
||||
private ActionListener forwardListener = e -> search(0);
|
||||
|
||||
public SearchBar(RSyntaxTextArea textArea) {
|
||||
rTextArea = textArea;
|
||||
@@ -81,6 +80,8 @@ class SearchBar extends JToolBar {
|
||||
nextButton.setBorderPainted(false);
|
||||
add(nextButton);
|
||||
|
||||
ActionListener forwardListener = e -> search(0);
|
||||
|
||||
markAllCB = new JCheckBox(NLS.str("search.mark_all"));
|
||||
markAllCB.addActionListener(forwardListener);
|
||||
add(markAllCB);
|
||||
|
||||
@@ -17,4 +17,7 @@ public class SystemInfo {
|
||||
public static final boolean IS_WINDOWS = LOWER_OS_NAME.startsWith("windows");
|
||||
public static final boolean IS_MAC = LOWER_OS_NAME.startsWith("mac");
|
||||
public static final boolean IS_LINUX = LOWER_OS_NAME.startsWith("linux");
|
||||
|
||||
private SystemInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user