pull/574/head
hengyunabc 6 years ago
commit 6f990a2cf3

@ -85,14 +85,16 @@ public class Decompiler {
path = classFileSource.adjustInputPath(path);
AnalysisType type = (AnalysisType) options.getOption(OptionsImpl.ANALYSE_AS);
if (type == null)
if (type == null) {
type = dcCommonState.detectClsJar(path);
}
if (type == AnalysisType.JAR) {
// doJar(dcCommonState, path, dumperFactory);
}
if (type == AnalysisType.CLASS)
if (type == AnalysisType.CLASS) {
result.append(doClass(dcCommonState, path, skipInnerClass, dumperFactory));
}
}
return result.toString();
}
@ -105,8 +107,9 @@ public class Decompiler {
Dumper d = new ToStringDumper();
try {
ClassFile c = dcCommonState.getClassFileMaybePath(path);
if ((skipInnerClass) && (c.isInnerClass()))
if ((skipInnerClass) && (c.isInnerClass())) {
return "";
}
dcCommonState.configureWith(c);
dumperFactory.getProgressDumper().analysingType(c.getClassType());
try {
@ -132,12 +135,14 @@ public class Decompiler {
// collectingDumper.getTypeUsageInformation(), illegalIdentifierDump);
String methname = (String) options.getOption(OptionsImpl.METHODNAME);
if (methname == null)
if (methname == null) {
c.dump(d);
}
else {
try {
for (Method method : c.getMethodByName(methname))
for (Method method : c.getMethodByName(methname)) {
method.dump(d, true);
}
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException("No such method '" + methname + "'.");
}
@ -146,18 +151,21 @@ public class Decompiler {
result.append(d.toString());
} catch (ConfusedCFRException e) {
result.append(e.toString()).append("\n");
for (Object x : e.getStackTrace())
for (Object x : e.getStackTrace()) {
result.append(x).append("\n");
}
} catch (CannotLoadClassException e) {
result.append("Can't load the class specified:").append("\n");
result.append(e.toString()).append("\n");
} catch (RuntimeException e) {
result.append(e.toString()).append("\n");
for (Object x : e.getStackTrace())
for (Object x : e.getStackTrace()) {
result.append(x).append("\n");
}
} finally {
if (d != null)
if (d != null) {
d.close();
}
}
return result.toString();
}

@ -191,12 +191,13 @@ public class NetUtils {
} catch (Exception e) {
return false;
} finally {
if (s != null)
if (s != null) {
try {
s.close();
} catch (Exception e) {
// ignore
}
}
}
}

@ -871,7 +871,9 @@ public abstract class StringUtils {
}
public static String classLoaderHash(Class<?> clazz) {
if (clazz == null || clazz.getClassLoader() == null) return "null";
if (clazz == null || clazz.getClassLoader() == null) {
return "null";
}
return Integer.toHexString(clazz.getClassLoader().hashCode());
}
@ -881,7 +883,9 @@ public abstract class StringUtils {
* @return human readable format
*/
public static String humanReadableByteCount(long bytes) {
if (bytes < UNIT) return bytes + " B";
if (bytes < UNIT) {
return bytes + " B";
}
int exp = (int) (Math.log(bytes) / Math.log(UNIT));
String pre = STRING_UNITS.charAt(exp-1) + "i";
return String.format("%.2f %sB", bytes / Math.pow(UNIT, exp), pre);

@ -136,7 +136,9 @@ public class Ansi {
};
public static void setDetector(final Callable<Boolean> detector) {
if (detector == null) throw new IllegalArgumentException();
if (detector == null) {
throw new IllegalArgumentException();
}
Ansi.detector = detector;
}
@ -698,8 +700,9 @@ public class Ansi {
}
private void flushAttributes() {
if (attributeOptions.isEmpty())
if (attributeOptions.isEmpty()) {
return;
}
if (attributeOptions.size() == 1 && attributeOptions.get(0) == 0) {
builder.append(FIRST_ESC_CHAR);
builder.append(SECOND_ESC_CHAR);

Loading…
Cancel
Save