Illegal State Exception error: target host must not be null or set in parameters
<p>I ran my app on my old galaxy s and it worked fine and then I my nexus s and it started giving me a few errors. I was getting an illegal character in path error in my JSONParser that I fixed by using URLEncoder.encode but now I am getting an illegal state exception error. I looked here <a href="http://blog.donnfelker.com/2010/04/29/android-odd-error-in-defaulthttpclient/" rel="nofollow">http://blog.donnfelker.com/2010/04/29/android-odd-error-in-defaulthttpclient/</a>
but I already had http:// in my url. I checked the debugger for the uri  of my httpget. I am not exactly sure what I am looking for here. I know that I am trying to find if a character has been encoded that shouldn't have been as suggest in the comments of the article I linked to above but I am not sure how how to go about doing that. When I click on my uri under httpGet in the JSONParser.doInBackground method I get %5BLjava.lang.String%3B%4042b3f010. Am I correct that this is the encoded representation from the URLEncoder.encode? I pass in to my JSONParser.doInBackground a url of the type StringBuilder that I convert to String and then encode. The myURL entry in the debugger gives me the same as the uri: %5BLjava.lang.String%3B%4042b3f010. Am I going about doing this correctly. Thank for any help. These are what I believe to be the relevant parts of my code:</p>

<pre><code>public class JSONParser extends AsyncTask&lt;String, Void, JSONObject&gt; {

static InputStream inputStream = null;
static JSONObject jObject = null;
static String jSon = "";
protected JSONObject doInBackground(String... url) {
    // TODO Auto-generated method stub

    //Make HTTP Request
            try {
                //defaultHttpClient
                DefaultHttpClient httpClient = new DefaultHttpClient();
                String myURL = url.toString(); 
                myURL = URLEncoder.encode(myURL, "utf-8");
                HttpGet httpGet = new HttpGet(myURL);

                //header
                httpGet.setHeader("Accept", "application/json");

                HttpResponse httpResponse = httpClient.execute(httpGet);
                HttpEntity httpEntity = httpResponse.getEntity();
                inputStream = httpEntity.getContent();

            } catch (UnsupportedEncodingException e){
                e.printStackTrace();
            } catch (ClientProtocolException e){
                e.printStackTrace();
            }catch (IOException e){
                e.printStackTrace();
            }

            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
                StringBuilder stringBuilder = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null){
                    stringBuilder.append(line + "\n");
                }
                Log.d("JSON Contents", stringBuilder.toString());
                inputStream.close();

                jSon = stringBuilder.toString();


            } catch (Exception e){
                Log.e("Buffer Error", "Error converting result " + e.toString());
            }
            //try to parse the string to JSON Object
            try {
                jObject = new JSONObject(jSon);

            } catch (JSONException e){
                Log.e("JSON Parser", "Error parsing data " + e.toString());
            }
            //return JSON String
            return jObject;
}

}
</code></pre>

<p>This is how I am building the url that I pass through to the parser:</p>

<pre><code>public class getName {
static String nameOne = null;
static String nameTwo = null;

static StringBuilder personURLOne = new StringBuilder();
static StringBuilder personURLTwo = new StringBuilder();

public static String personURL = "http://api.themoviedb.org/3/search/person?api_key=bb0b6d66c2899aefb4d0863b0d37dc4e&amp;query=";

public static StringBuilder getName1(EditText searchOne){
    nameOne = searchOne.getText().toString();


    nameOne = nameOne.replace(" ", "_");


    personURLOne.append(personURL); 
    personURLOne = personURLOne.append(nameOne);



    return personURLOne;

}
</code></pre>

<p>Appreciate any help</p>

<p>UPDATE - I changed my code to the following in my JSONParser:</p>

<pre><code>public class JSONParser extends AsyncTask&lt;String, Void, JSONObject&gt; {

static InputStream inputStream = null;
static JSONObject jObject = null;
static String jSon = "";
public String myURL;
protected JSONObject doInBackground(String... url) {
    // TODO Auto-generated method stub

    //Make HTTP Request
            try {
                //defaultHttpClient
                DefaultHttpClient httpClient = new DefaultHttpClient();
                for(int i = 0; i &lt; url.length; i++){
                     myURL = url[0];
                     myURL = URLEncoder.encode(myURL, "utf-8");
                }
                HttpGet httpGet = new HttpGet(myURL);
</code></pre>
