正在保存带有linkedlist的对象-API 10上出现错误



在android API 10上使用LinkedList保存对象时,我获得错误:

08-10 14:37:45.091: E/AndroidRuntime(29845): FATAL EXCEPTION:
Thread-17 08-10 14:37:45.091: E/AndroidRuntime(29845):
java.lang.IllegalArgumentException: no char field 'exponential' 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.io.EmulatedFields.put(EmulatedFields.java:459) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.io.EmulatedFieldsForDumping.put(EmulatedFieldsForDumping.java:83)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.text.DecimalFormatSymbols.writeObject(DecimalFormatSymbols.java:591)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.lang.reflect.Method.invokeNative(Native Method) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invoke(Method.java:507) 08-10 14:37:45.091:
E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1219)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1062)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:1008)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.text.DecimalFormat.writeObject(DecimalFormat.java:1215) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invokeNative(Native Method) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invoke(Method.java:507) 08-10 14:37:45.091:
E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1219)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1143)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1241)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1205)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1143)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1241)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.util.LinkedList.writeObject(LinkedList.java:973) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invokeNative(Native Method) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invoke(Method.java:507) 08-10 14:37:45.091:
E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1219)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1143)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1241)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.util.LinkedList.writeObject(LinkedList.java:973) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invokeNative(Native Method) 08-10
14:37:45.091: E/AndroidRuntime(29845):    at
java.lang.reflect.Method.invoke(Method.java:507) 08-10 14:37:45.091:
E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1219)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
08-10 14:37:45.091: E/AndroidRuntime(29845):  at java.io.Ob

我不知道哪里有故障,我不认为linkedlist是一个问题,因为它是从API 1,但它从来没有发生在安卓API 18,知道哪里有问题吗?

保存:

FileOutputStream fos = null;
    try {
        fos = openFileOutput("shelf.obj", Context.MODE_PRIVATE);
        ObjectOutputStream out = new ObjectOutputStream(fos);
        out.writeObject(listOfShelfs);
        out.close();
        fos.close();
    } catch (FileNotFoundException e) {
        //catch
    } catch (IOException e) {
        //catch
    }

要保存的对象:

private static HashMap<String, MessageShelf> listOfShelfs = new HashMap<String, MessageShelf>();

MessageShelf:

public class MessageShelf implements Serializable{
private static final long serialVersionUID = 1L;
public Friend correspodent;
Calendar lastSeen;
Calendar lastSend;
boolean secure;
Queue<MessageList> historyMessagesLists=new LinkedList<MessageList>();
public String lastMessageBody = "";
public Calendar lastDate;}

这似乎是Bug 14495:Android 2.3和3.0的DecimalFormatSymbols序列化被破坏。

相关内容

  • 没有找到相关文章

最新更新