Exception thrown on assignment of an array to another array
<p>I have a function which fetches a certain website's HTML code. Eventually that function will return the whole page as an array. I am trying to save the page in another array, but it will always throw an exception (ArrayIndexOutOfBoundsException) for some reason.</p>

<p>I am not sure if I am just missing something elementary or if it's more than just that. To give you some of my code:      </p>

<pre><code>  protected String[] doInBackground(String... login)
        {
            String[] page = new String[1024];
            try {
                page = executeHttpGet(); //THIS IS WHERE IT FAILS
            } catch (Exception e) {
                page[0] = "Error";
            }
            return page;
        }

public String[] executeHttpGet() throws Exception {
         URL u;
         InputStream is = null;
         DataInputStream dis;
         String s;
         int i = 0;
         String[] page = new String[1024];
         addSecurityException();
         Authenticator.setDefault(new MyAuthenticator(activity));
         try {
            u = new URL("https://myurl.com");
            is = u.openStream();        
            dis = new DataInputStream(new BufferedInputStream(is));
            while ((s = dis.readLine()) != null) {
                if (s.toString().length() &gt; 10)
                    {
                    page[i] = s.toString();
                    i++;
                    }
            }
        } catch (IOException ioe) {

        }
         finally {
            try {
               is.close();
            } catch (IOException ioe) {

            }
        } 
         return page;
    }
    }
</code></pre>

<p>Does anyone have any ideas why I am not able to assign the returned array to the array in doInBackground()? Help would be greatly appreciated. </p>
