1

私の Android アプリケーションは、コードのこの部分でクラッシュしました:

ois = new ObjectInputStream(socket.getInputStream());
Object obj = ois.readObject();

関数 readObject() を呼び出すとき。

何時間も問題なく動作した後、次のことが起こりました。

07-03 07:52:34.409: E/AndroidRuntime(1600): FATAL EXCEPTION: Thread-215
07-03 07:52:34.409: E/AndroidRuntime(1600): java.lang.IndexOutOfBoundsException: Invalid index 1937902936, size is 28
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.util.ArrayList.get(ArrayList.java:304)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.registeredObjectRead(ObjectInputStream.java:2157)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readCyclicReference(ObjectInputStream.java:833)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:692)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1799)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1999)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1956)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.util.concurrent.CopyOnWriteArrayList.readObject(CopyOnWriteArrayList.java:766)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.lang.reflect.Method.invokeNative(Native Method)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.lang.reflect.Method.invoke(Method.java:511)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1354)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1266)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1851)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1999)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1956)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at com.vittorio.floaty.AcceptThread.run(AcceptThread.java:80)
07-03 07:52:34.409: E/AndroidRuntime(1600):     at java.lang.Thread.run(Thread.java:856)

これはどのように起こりますか?つまり、インデックスが大きすぎてあまり意味がありません。とにかく、ArrayList を含むシリアル化されたオブジェクトを交換しています。

4

0 に答える 0