RuntimeException-错误的第二个字节位于19

时间:2019-07-19 20:27:14

标签: codenameone

以下是生产中来自App的错误日志。在这里了解第二个坏字节问题的简便方法是什么。在这里为我提供任何指导。 此错误被抛出在不同的字节上..有时是2,有时是19等。我无法在模拟器上重现此问题。这种情况很少发生,但我不确定是什么导致了此问题。

[EDT] 0:23:57,929 - Exception: java.lang.RuntimeException - bad second byte at 19
   java.lang.RuntimeException
    at java_io_DataInputStream.decode:207
    at java_io_DataInputStream.decodeUTF:187
    at java_io_DataInputStream.decodeUTF:181
    at java_io_DataInputStream.readUTF:177
    at com_codename1_io_Util.readUTF:1081
    at com__server_Activity.internalize:571
    at com_codename1_io_Util.readObject:714
    at com_codename1_io_Util.readObject:689
    at com_codename1_io_Storage.readObject:264
    at com_server_ServerImpl.getActivitiesOfflineMode:1898
    at com__forms_AppointmentForm.lambda$onShowCompleted$14:636
    at com__forms_AppointmentForm__Lambda_9.run:276
    at com_codename1_ui_Display.processSerialCalls:1298
    at com_codename1_ui_Display.edtLoopImpl:1242
    at com_codename1_ui_Display.mainEDTLoop:1130
    at com_codename1_ui_RunnableWrapper.run:120
    at com_codename1_impl_CodenameOneThread.run:176
    at java_lang_Thread.runImpl:153

1 个答案:

答案 0 :(得分:0)

Activity internalizeexternalize似乎不对称,所写的数据与读取的数据不同,导致损坏。您正在readUTF行之前进行此操作。在您到达readUTF呼叫时,数据已损坏,因此会出现此错误。