2013-07-29 209 views
2

我調試J2ME(寫在日食)代碼的諾基亞N95(不是我寫的),試圖找到錯誤並打印出堆棧跟蹤給了我這個:J2ME應用程序混淆棧跟蹤

03:08:479 TSKR. Error: 
    java.lang.NullPointerException: 0 
- java.lang.String.<init>(), bci=6 
    - v.b(), bci=9 
- v.e(), bci=805 
- v.e(), bci=3 

任何人都可以請幫我理解一下?哪一行,哪裏可以找到,並且有辦法理解它,或者至少得到一些有價值和有用的信息。 謝謝

UPDATE

對不起..下面是拋出錯誤的功能:

public void  bluetoothFileProcessBytes(){//--------tracing out of memory error 
    try{ 

    partCurrentLoop++;   
    fileCurrentLoop++; 

    debug("Loop " + fileCurrentLoop + " of " + fileTotalLoops); 

    bluetoothUpdateBytes(fileDataString.length()); 
    guiUpdateProgressBar(true, partCurrentLoop, partTotalLoops); 

    // LOOP Step 2: If there is no byte[] created for storing the bytes, create it. 

    if (fileBytesIsEmpty) { 

     if (partCurrentNumber == partTotalNumber) 
     { 
      fileBytes = new byte[fileSize % (loopsPerHttpComm * BYTES_PER_LOOP)]; 
     } 
     else fileBytes = new byte[loopsPerHttpComm * BYTES_PER_LOOP];      


    } 
    fileBytesIsEmpty = false; 


    //LOOP Step 3: fill in the byte array with data from StringBuffer 


    for (int i = 0; i < fileDataString.length(); i++) 
    { 
     j = i + (partCurrentLoop - 1) * BYTES_PER_LOOP; 
     c = fileDataString.charAt(i);    
     fileBytes[j] = (byte) c; 
    } 
    c=0; 
    j=0; 
    i=0; 

    //LOOP Step 4: Send the email if the byte array is full with a new HttpComm Thread 

    if ((fileCurrentLoop % loopsPerHttpComm == 0 
      || fileCurrentLoop == fileTotalLoops) && checkHttpCommStatus()) { 


     // update partName and httpCommStatus 
     String partName = fileName + " .part " + partCurrentNumber;    

     httpCommStatus = HTTP_RUNNING; 

     if (fileCurrentLoop == fileTotalLoops) {  // FILE_END     
      debug("New HttpComm Thread: FILE END"); 

      httpCommUpdateBytes(fileBytes.length);//<===================remove 
      httpCommSucceeded();//<====================================remove 



    /*new Thread(new HttpFileEnd(this, fileBytes, toAddress, fromAddress, fromName, digidownMAC, partName, fileName, fileSize, digidownSoftwareVersion, partCurrentNumber, //<===============uncomment 
        partTotalNumber, DigidownApp.textObject.getActiveLanguage())).start();*/ 


     } else {         // FILE_PART 


      //debug("Step 5");//<--------------------------------------------------------------------------------<-remove 
     debug("New HttpComm Thread: FILE PART: " + partName); 
     debug(">>>>>SEEEENDIIIING!<<<<<<<<");//<===========remove 
     httpCommUpdateBytes(fileBytes.length);//<================remove 
     httpCommSucceeded();//<==============================remove 

/*new Thread(new HttpFilePart(this, fileBytes, toAddress, fromAddress, fromName,//<===============uncomment 
        digidownMAC, partName, fileSize, digidownSoftwareVersion, 
        partCurrentNumber, DigidownApp.textObject.getActiveLanguage())).start();*/ 


    // Updating the new partTotalLoops 
    if (partCurrentNumber == partTotalNumber){ 
partTotalLoops = fileTotalLoops - (loopsPerHttpComm * (partCurrentNumber - 1));    
      } else partTotalLoops = loopsPerHttpComm; 


      partCurrentNumber++; 
      partCurrentLoop = 0; 
     } 
     fileBytesIsEmpty = true; 
     } 

    // Leave the loop if failed 
    if (!errorHandlerActivated) { 

     if (fileCurrentLoop < fileTotalLoops) 
     { 

     try{ 
     bluetoothIOStream.getFileBytes();//-throws null pointer exception ! 
     }catch(RuntimeException ea){debug("Wammaaa!!! " + ea.toString()); 
         ea.printStackTrace();} 

     } 
     else if(fileCurrentLoop == fileTotalLoops && checkHttpCommStatus()) 
        { bluetoothIOStream.getFileEnd(); } 
    } 
    } 



    catch(RuntimeException e1) 
    { 
    Alert alert = new Alert("Fckn error!", e1.toString(), null, null); 
    alert.setTimeout(Alert.FOREVER); 
    debug("Error:"); 
    System.err.println(); 
    e1.printStackTrace(); 
    //throw e1; 

    } 
} 

..和是非模糊的應用程序的堆棧跟蹤;這一次是空指針異常後 // Leave the loop if failed

02:57:382 TSKR. Loop 972 of 1349 
02:57:383 BIOS. Rec 978 
02:57:588 TSKR. Loop 973 of 1349 
02:57:590 BIOS. Rec 979 
02:57:815 TSKR. Wammaaa!!! java.lang.NullPointerException: 0 
java.lang.NullPointerException: 0 
- java.lang.String.<init>(), bci=6 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.readLineAsString(), bci=9 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=844 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getFileBytes(), bci=3 
- net.digidown.m.digidown.TaskRunner.bluetoothFileProcessBytes(), bci=430 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=857 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getFileBytes(), bci=3 
- net.digidown.m.digidown.TaskRunner.bluetoothFileProcessBytes(), bci=430 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=857 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getFileBytes(), bci=3 
- net.digidown.m.digidown.TaskRunner.bluetoothFileProcessBytes(), bci=430 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=857 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getFileBytes(), bci=3 
- net.digidown.m.digidown.TaskRunner.bluetoothFileProcessBytes(), bci=430 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=857 

是這樣,對於一段時間,然後..:

- net.digidown.m.digidown.TaskRunner.bluetoothDoCommand_file(), bci=227 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=829 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getFileSettings(), bci=9 
- net.digidown.m.digidown.TaskRunner.bluetoothTask(), bci=90 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=513 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getTask(), bci=2 
- net.digidown.m.digidown.TaskRunner.bluetoothTask(), bci=172 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=513 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getTask(), bci=2 
- net.digidown.m.digidown.TaskRunner.bluetoothConnected(), bci=89 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=444 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.getVariable(), bci=426 
- net.digidown.m.digidown.bluetooth.BluetoothIOStream.run(), bci=366 
- java.lang.Thread.run(), bci=11 
03:01:211 TSKR. Finished Task 
03:01:212 BIOS. Rec 6 
03:01:356 BIOS. task = > 
03:01:357 TSKR. :: Got Task: (0x3e) 
03:01:358 TSKR. 
03:01:359 TSKR. ERROR HANDLER: 116 - Bluetooth communication error 
03:01:389 BIOS. Initiated 
03:01:389 BIOS. About to read 
03:01:394 BIOS. Phone(InitiateDigidownError) received: '0x3e 0xea Data CK' 
03:01:397 BIOS. About to writeLine 'error' 
03:01:468 BIOS. quitStatus = QUIT_STATUS 
+0

代碼在哪裏? – Reimeus

+0

對不起...我添加了soem代碼 – Dims

+0

你的'fileDataString'初始化過程如何? – DRastislav

回答

2

你的問題似乎是模糊處理。

您的eclipse應用程序的構建過程可能使用像proguard這樣的工具來提高性能並減小將在該字段中部署的應用程序.jar文件的大小。

混淆的一件事是將類和方法名重寫爲更小的名稱,因此完全無法理解您的堆棧跟蹤的最後3行。

當需要調試應用程序時,需要生成一個未混淆的.jar文件。
(至少直到你發現只有可能發生在你的應用程序的模糊版本的問題。它發生)

Eclipse應該會允許你通過修改項目屬性打開混淆關閉(或將其降低到最低水平) 。如果做不到這一點,手動和暫時地攻擊用於構建.jar文件的ant .xml文件將會有所斬獲。

模糊處理參數應包含MIDlet類的名稱,以便其startApp()方法不會重命名。

+0

謝謝,我會嘗試.. – Dims

+0

我試着創建unobfuscated包,現在我有一些信息..但仍然不能理解什麼是java.lang.String。 (),bci = 6。同樣在錯誤出現後,在一個堆棧跟蹤中,我可以看到三個重複上帝的函數知道多少次... – Dims

+0

順便說一下,什麼是bci ...? – Dims

1

您的問題可能通過兩種方式解決:

  1. 沒有混淆運行應用程序。所以輸出顯示確切的方法名稱。
  2. System.out.println('method_name::sample_tag')放在你的方法和問題可能來自他們的行。然後在輸出中,您可以跟蹤執行情況,並可以找到問題發生的位置。
+1

謝謝!對不起,我對java不熟悉 - 什麼是樣本標籤? – Dims

+0

'sample_tag'只是一個標籤(或註釋),您可以通過在輸出中查看來找到您的跟蹤。 (你可以選擇任何你想要的) – Saeed