title: Fatal exception : AsyncTask #1
body: <p>I want to use a AsynTask to parse XML data.
  So in the Activity i've : </p>
  
  <pre><code>static List&lt;String&gt; citations = null;
  
      static void setCitations(List&lt;String&gt; data) {
          citations = data;
      }
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
  
  
        super.onCreate(savedInstanceState);
  
        new data().execute();
  </code></pre>
  
  <p>And in the data class i've : </p>
  
  <pre><code>class data extends AsyncTask&lt;Void, Void, List&lt;String&gt;&gt; {
  
      private XMLReader saxReader;
      private SimpleContentHandler simpleContentHandler;
  
      private List&lt;String&gt; citations;
  
      @Override
      protected void onPreExecute() {
          Log.i("AsyncTask", "onPreExecute");
      }
  
      @Override
      public void onPostExecute(List&lt;String&gt; citations) {
          GuiguiActivity.setCitations(citations);
      }
  
  
      @Override
      protected List&lt;String&gt; doInBackground(Void... params) {
                citations.add("TEST 1");citations.add("TEST 2");
                return citations;
           }   
  }
  </code></pre>
  
  <p>Instead of the citations.add i've my XML parser, but even in this case with citations.add errors occur.</p>
  
  <pre><code>10-24 15:28:46.647: E/AndroidRuntime(1160): FATAL EXCEPTION: AsyncTask #1
  10-24 15:28:46.647: E/AndroidRuntime(1160): java.lang.RuntimeException: An error occured while executing doInBackground()
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at android.os.AsyncTask$3.done(AsyncTask.java:278)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.lang.Thread.run(Thread.java:856)
  10-24 15:28:46.647: E/AndroidRuntime(1160): Caused by: java.lang.NullPointerException
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at guigui.first.project.data.doInBackground(data.java:82)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at guigui.first.project.data.doInBackground(data.java:1)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at android.os.AsyncTask$2.call(AsyncTask.java:264)
  10-24 15:28:46.647: E/AndroidRuntime(1160):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  </code></pre>
  
  <p>I don't see where the problem is.</p>
  
  <p>Thanks :)</p>