title: Android loading array list of string arrays EOF Exception
body: <p>I'm loading an ArrayList using ObjectInputStream in my application. Weirdly, it seems to have worked fine up until recently. I can't see what's causing it.</p>
  
  <p>Here are the snippets of code involved:</p>
  
  <pre><code>protected ArrayList&lt;String[]&gt; LoadDetailList() {
      InputStream breedin;
      ArrayList&lt;String[]&gt; list = null;
      try {
          breedin = openFileInput("DetailList.ser");
          list = SaveAndLoad.doLoadDetailList(breedin);
      } catch (FileNotFoundException e) {
          System.out.println("Details List not found");
          list = new ArrayList&lt;String[]&gt;();
      }
      Stored.addAllDetails(list);
      return list;
  }
  
  @SuppressWarnings("unchecked")
  public static ArrayList&lt;String[]&gt; doLoadDetailList(InputStream breedin) {
      ArrayList&lt;String[]&gt; h = null;
  
      try {
  
          ObjectInputStream in = new ObjectInputStream(breedin);
  
          h = (ArrayList&lt;String[]&gt;) in.readObject();
  
          in.close();
          breedin.close();
  
      } catch (ClassNotFoundException e) {
          e.printStackTrace();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      return h;
  }
  </code></pre>
  
  <p>And the exception:</p>
  
  <pre><code>10-01 14:58:07.130: W/System.err(23213): java.io.EOFException
  10-01 14:58:07.130: W/System.err(23213):    at java.io.DataInputStream.readByte(DataInputStream.java:98)
  10-01 14:58:07.130: W/System.err(23213):    at java.io.ObjectInputStream.nextTC(ObjectInputStream.java:506)
  10-01 14:58:07.130: W/System.err(23213):    at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:778)
  10-01 14:58:07.130: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readNewArray(ObjectInputStream.java:1512)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:785)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
  10-01 14:58:07.135: W/System.err(23213):    at java.util.ArrayList.readObject(ArrayList.java:657)
  10-01 14:58:07.135: W/System.err(23213):    at java.lang.reflect.Method.invokeNative(Native Method)
  10-01 14:58:07.135: W/System.err(23213):    at java.lang.reflect.Method.invoke(Method.java:511)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1354)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1266)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1855)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
  10-01 14:58:07.135: W/System.err(23213):    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
  10-01 14:58:07.140: W/System.err(23213):    at admin.SaveAndLoad.doLoadDetailList(SaveAndLoad.java:309)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.LoadDetailList(SendService.java:406)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.getHolding(SendService.java:316)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.processResponse(SendService.java:152)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.sendMessage(SendService.java:128)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService$1.run(SendService.java:71)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.startThread(SendService.java:93)
  10-01 14:58:07.140: W/System.err(23213):    at services.server.SendService.onHandleIntent(SendService.java:49)
  10-01 14:58:07.140: W/System.err(23213):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  10-01 14:58:07.140: W/System.err(23213):    at android.os.Handler.dispatchMessage(Handler.java:99)
  10-01 14:58:07.140: W/System.err(23213):    at android.os.Looper.loop(Looper.java:137)
  10-01 14:58:07.140: W/System.err(23213):    at android.os.HandlerThread.run(HandlerThread.java:60)
  </code></pre>
  
  <p>Any ideas what I'm doing wrong?</p>
  
  <p>Thanks.</p>