jadx导致一个失败的sourcode?

时间:2017-03-26 19:31:44

标签: java decompiler

我刚刚使用Jadx来反编译*.apk文件。该应用仍然运行正常。在Java Decompiler上查看结果:

public class Information extends BaseInformation implements InformationInterface {
    private static final String LOG_TAG = "Information.java";
    public String decimalLength;
    public String expression;
    public String length;
    public String signed;
    public String start;
    public String unit;

    public Information() {
        this.signed = "N";
    }

    public String toString() {
        return "information name = " + this.nameZh;
    }

    public boolean isSigned() {
        if ("Y".equals(this.signed)) {
            return true;
    }
    return false;
}

public String getValue() {
    if (BluetoothTools.cmdArray == null || BluetoothTools.cmdArray.size() == 0) {
        return this.unit;
    }
    int startInt = Integer.parseInt(this.start);
    int lengthInt = Integer.parseInt(this.length);
    int dLength = Integer.parseInt(this.decimalLength);
    StringBuffer sb = new StringBuffer();
    int i;
    StringBuffer stringBuffer;
    int i2;
    if (ConfigManager.getInstance().isBigEndian()) {
        for (i = (startInt + lengthInt) - 1; i >= startInt; i--) {
            stringBuffer = sb;
            i2 = 0;
            stringBuffer.insert(i2, (String) BluetoothTools.cmdArray.get(i));
        }
    } else {
        for (i = startInt; i < startInt + lengthInt; i++) {
            stringBuffer = sb;
            i2 = 0;
            stringBuffer.insert(i2, (String) BluetoothTools.cmdArray.get(i));
        }
    }
    String hexString = sb.toString();
    long intValue = 0;
    try {
        if (isSigned()) {
            intValue = new BigInteger(Hex2StringUtils.hexStringToByte(hexString)).longValue();
            Log.i(LOG_TAG, "isSigned intValue: " + intValue);
        } else {
            intValue = Long.parseLong(hexString, 16);
        }
    } catch (NumberFormatException e1) {
        e1.printStackTrace();
    }
    String value = "";
    try {
        BigDecimal b = new BigDecimal(new ExpressionParser().calculate(this.expression.replace("x", new StringBuilder(String.valueOf(intValue)).toString())));
        if (dLength > 0) {
            return new StringBuilder(String.valueOf(b.setScale(dLength, 4).doubleValue())).append(this.unit).toString();
        } else if (dLength != 0) {
                   return value;
               } else {
                          return new StringBuilder(String.valueOf(b.setScale(dLength, 4).intValue())).append(this.unit).toString();
                      }
        } catch (ParserException e) {
            e.printStackTrace();
            return value;
        }
    }
}

这个类反编译失败了吗?

StringBuffer sb会发生什么?

它看起来像不包含任何字符串,因此hexString仍为NULL。

任何人都可以解释一下吗?

1 个答案:

答案 0 :(得分:0)

在两个地方有内容插入字符串缓冲区。例如,这里

        stringBuffer = sb;
        i2 = 0;
        stringBuffer.insert(i2, (String) BluetoothTools.cmdArray.get(i));

所以不,hexString的结果不会为null(或空字符串)。