don't use concatenation in logger, fix other small code style issues
This commit is contained in:
@@ -18,7 +18,7 @@ public class JadxCLI {
|
||||
processAndSave(jadxArgs);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
LOG.error("jadx error: " + e.getMessage(), e);
|
||||
LOG.error("jadx error: {}", e.getMessage(), e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class JadxCLI {
|
||||
} else {
|
||||
outDirName = name + "-jadx-out";
|
||||
}
|
||||
LOG.info("output directory: " + outDirName);
|
||||
LOG.info("output directory: {}", outDirName);
|
||||
outputDir = new File(outDirName);
|
||||
jadxArgs.setOutputDir(outputDir);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package jadx.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class JavaPackage implements JavaNode, Comparable<JavaPackage> {
|
||||
private final String name;
|
||||
private final List<JavaClass> classes;
|
||||
@@ -32,7 +34,7 @@ public final class JavaPackage implements JavaNode, Comparable<JavaPackage> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(JavaPackage o) {
|
||||
public int compareTo(@NotNull JavaPackage o) {
|
||||
return name.compareTo(o.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class ResourcesLoader {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static interface ResourceDecoder {
|
||||
public interface ResourceDecoder {
|
||||
Object decode(long size, InputStream is) throws IOException;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class ResourcesLoader {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("Error close zip file: " + zipRef, e);
|
||||
LOG.debug("Error close zip file: {}", zipRef, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public final class ResourcesLoader {
|
||||
try {
|
||||
zip.close();
|
||||
} catch (Exception e) {
|
||||
LOG.error("Zip file close error: " + file.getAbsolutePath(), e);
|
||||
LOG.error("Zip file close error: {}", file.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,12 +153,8 @@ public class MethodGen {
|
||||
if (mth.contains(AType.JADX_ERROR)
|
||||
|| mth.contains(AFlag.INCONSISTENT_CODE)
|
||||
|| mth.getRegion() == null) {
|
||||
code.startLine("throw new UnsupportedOperationException(\"Method not decompiled: ")
|
||||
.add(mth.toString())
|
||||
.add("\");");
|
||||
|
||||
if (mth.contains(AType.JADX_ERROR)) {
|
||||
JadxErrorAttr err = mth.get(AType.JADX_ERROR);
|
||||
JadxErrorAttr err = mth.get(AType.JADX_ERROR);
|
||||
if (err != null) {
|
||||
code.startLine("/* JADX: method processing error */");
|
||||
Throwable cause = err.getCause();
|
||||
if (cause != null) {
|
||||
@@ -171,6 +167,10 @@ public class MethodGen {
|
||||
code.startLine("/*");
|
||||
addFallbackMethodCode(code);
|
||||
code.startLine("*/");
|
||||
|
||||
code.startLine("throw new UnsupportedOperationException(\"Method not decompiled: ")
|
||||
.add(mth.toString())
|
||||
.add("\");");
|
||||
} else {
|
||||
RegionGen regionGen = new RegionGen(this);
|
||||
regionGen.makeRegion(code, mth.getRegion());
|
||||
|
||||
@@ -257,7 +257,7 @@ public class RegionGen extends InsnGen {
|
||||
} else if (k instanceof Integer) {
|
||||
code.add(TypeGen.literalToString((Integer) k, arg.getType()));
|
||||
} else {
|
||||
throw new JadxRuntimeException("Unexpected key in switch: " + (k != null ? k.getClass() : k));
|
||||
throw new JadxRuntimeException("Unexpected key in switch: " + (k != null ? k.getClass() : null));
|
||||
}
|
||||
code.add(':');
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TypeGen {
|
||||
case OBJECT:
|
||||
case ARRAY:
|
||||
if (lit != 0) {
|
||||
LOG.warn("Wrong object literal: " + lit + " for type: " + type);
|
||||
LOG.warn("Wrong object literal: {} for type: {}", lit, type);
|
||||
return Long.toString(lit);
|
||||
}
|
||||
return "null";
|
||||
|
||||
@@ -94,17 +94,17 @@ public class CheckRegions extends AbstractVisitor {
|
||||
}
|
||||
|
||||
private void printRegion(MethodNode mth) {
|
||||
LOG.debug("|" + mth.toString());
|
||||
LOG.debug("|{}", mth.toString());
|
||||
printRegion(mth, mth.getRegion(), "| ");
|
||||
}
|
||||
|
||||
private void printRegion(MethodNode mth, IRegion region, String indent) {
|
||||
LOG.debug(indent + region);
|
||||
LOG.debug("{}{}", indent, region);
|
||||
for (IContainer container : region.getSubBlocks()) {
|
||||
if (container instanceof IRegion) {
|
||||
printRegion(mth, (IRegion) container, indent + " ");
|
||||
} else {
|
||||
LOG.debug(indent + " " + container);
|
||||
LOG.debug("{} {}", indent, container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ErrorsCounter {
|
||||
if (e.getClass() == JadxOverflowException.class) {
|
||||
// don't print full stack trace
|
||||
e = new JadxOverflowException(e.getMessage());
|
||||
LOG.error(msg + ", message: " + e.getMessage());
|
||||
LOG.error("{}, message: {}", msg, e.getMessage());
|
||||
} else {
|
||||
LOG.error(msg, e);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class ResTableParser extends CommonBinaryParser {
|
||||
if ((b1 & 0x80) == 0) {
|
||||
str = new String(new char[]{(char) b1, (char) b2});
|
||||
} else {
|
||||
LOG.warn("TODO: parse locale: 0x" + Integer.toHexString(b1) + Integer.toHexString(b1));
|
||||
LOG.warn("TODO: parse locale: 0x{}{}", Integer.toHexString(b1), Integer.toHexString(b2));
|
||||
}
|
||||
}
|
||||
return str;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ValuesParser extends ParserConstants {
|
||||
return decodeComplex(data, true);
|
||||
|
||||
default:
|
||||
LOG.warn("Unknown data type: 0x" + Integer.toHexString(dataType) + " " + data);
|
||||
LOG.warn("Unknown data type: 0x{} {}", Integer.toHexString(dataType), data);
|
||||
return " ?0x" + Integer.toHexString(dataType) + " " + data;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class TestVariablesDefinitions extends IntegrationTest {
|
||||
DepthTraversal.visit(pass, cls);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Decode exception: " + cls, e);
|
||||
LOG.error("Decode exception: {}", cls, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class JadxGUI {
|
||||
}
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
LOG.error("Error: " + e.getMessage());
|
||||
LOG.error("Error: {}", e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ public class JadxWrapper {
|
||||
try {
|
||||
this.decompiler.loadFile(file);
|
||||
} catch (DecodeException e) {
|
||||
LOG.error("Error decode file: " + file, e);
|
||||
LOG.error("Error decode file: {}", file, e);
|
||||
} catch (JadxException e) {
|
||||
LOG.error("Error open file: " + file, e);
|
||||
LOG.error("Error open file: {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class ContentArea extends RSyntaxTextArea {
|
||||
try {
|
||||
setCaretPosition(getLineStartOffset(line));
|
||||
} catch (BadLocationException e) {
|
||||
LOG.debug("Can't scroll to " + line, e);
|
||||
LOG.debug("Can't scroll to {}", line, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
class SearchBar extends JToolBar {
|
||||
private static final long serialVersionUID = 1836871286618633003L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SearchDialog.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SearchBar.class);
|
||||
|
||||
private static final Color COLOR_BG_ERROR = new Color(0xFFDFDE);
|
||||
private static final Color COLOR_BG_WARN = new Color(0xFFFDD9);
|
||||
|
||||
@@ -20,7 +20,7 @@ import static java.awt.Desktop.Action;
|
||||
public class Link extends JLabel implements MouseListener {
|
||||
private static final long serialVersionUID = 3655322136444908178L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JLabel.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Link.class);
|
||||
|
||||
private String url;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user