weixin_41870203 2019-04-09 14:38 采纳率: 0%
浏览 1374

jar包中class文件中的代码与java 源文件代码不一致

使用 android studio 将java代码 生成.jar 包,通过 android studio 打开jar包,发现其中的class 文件中的代码与java 源文件代码不一致,而且class 文件中的代码有问题

java 代码:
public synchronized boolean Deserialize(String data) {
        int MaxSlots;
        int MaxChunksPerSlot;
        int ChunkSize;
        int TotalSize;

        if (null == data)
            return false;

        if (data.isEmpty())
        {
            destroy();
            return true;
        }

        String[] arrayData = data.split(" ");
        int arrdatalen = arrayData.length;
        if (arrdatalen < 5)
            return false;

       _** int idex = 0;**_
        try {
            ChunkSize =  Integer.parseInt(arrayData[idex++]);
            MaxSlots =  Integer.parseInt(arrayData[idex++]);
            MaxChunksPerSlot =  Integer.parseInt(arrayData[idex++]);
            TotalSize =  Integer.parseInt(arrayData[idex++]);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            return false;
        }


        if(!(MaxSlots < 10000 && MaxChunksPerSlot < 10000 && ChunkSize < 10000))
            return false;

        if (TotalSize > MaxSlots * MaxChunksPerSlot * ChunkSize)
            return false;

        destroy();
        m_MaxSlots = MaxSlots;
        m_MaxChunksPerSlot = MaxChunksPerSlot;
        m_ChunkSize = ChunkSize; 
        count = TotalSize;
        buf = new byte[count];
        int opindex = 0;
        while (idex < arrdatalen)
        {
            int chunk_id =  Integer.parseInt(arrayData[idex++]);
            int base64_size =  Integer.parseInt(arrayData[idex++]);

            byte[] pBuffer = new byte[ChunkSize];

            int ret = Util.Base64_Decode(arrayData[idex++], base64_size, pBuffer, ChunkSize);

            if (ret < 0) return false;

            if (ret + opindex <= count)
                System.arraycopy(pBuffer, 0, this.buf, opindex, ret);
            opindex += ret;

            data += base64_size;
        }

        return true;
    }


//.class 文件代码

  public synchronized boolean Deserialize(String data) {
        if (null == data) {
            return false;
        } else if (data.isEmpty()) {
            this.destroy();
            return true;
        } else {
            String[] arrayData = data.split(" ");
            int arrdatalen = arrayData.length;
            if (arrdatalen < 5) {
                return false;
            } else {
                **byte idex = 0;**

                int MaxSlots;
                int MaxChunksPerSlot;
                int ChunkSize;
                int TotalSize;
                _**int idex;**_
                try {
                    **_idex = idex + 1;_**
                    ChunkSize = Integer.parseInt(arrayData[idex]);
                    MaxSlots = Integer.parseInt(arrayData[idex++]);
                    MaxChunksPerSlot = Integer.parseInt(arrayData[idex++]);
                    TotalSize = Integer.parseInt(arrayData[idex++]);
                } catch (NumberFormatException var14) {
                    var14.printStackTrace();
                    return false;
                }

                if (MaxSlots < 10000 && MaxChunksPerSlot < 10000 && ChunkSize < 10000) {
                    if (TotalSize > MaxSlots * MaxChunksPerSlot * ChunkSize) {
                        return false;
                    } else {
                        this.destroy();
                        this.m_MaxSlots = MaxSlots;
                        this.m_MaxChunksPerSlot = MaxChunksPerSlot;
                        this.m_ChunkSize = ChunkSize;
                        this.count = TotalSize;
                        this.buf = new byte[this.count];

                        int base64_size;
                        for(int opindex = 0; idex < arrdatalen; data = data + base64_size) {
                            Integer.parseInt(arrayData[idex++]);
                            base64_size = Integer.parseInt(arrayData[idex++]);
                            byte[] pBuffer = new byte[ChunkSize];
                            int ret = Util.Base64_Decode(arrayData[idex++], base64_size, pBuffer, ChunkSize);
                            if (ret < 0) {
                                return false;
                            }

                            if (ret + opindex <= this.count) {
                                System.arraycopy(pBuffer, 0, this.buf, opindex, ret);
                            }

                            opindex += ret;
                        }

                        return true;
                    }
                } else {
                    return false;
                }
            }
        }
    }
    ```
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)