HTTP Client in Apache return "Target host must not be null"

Dear experts,
I am using Apache HTTP client library for Android emulator.

However whenever I enter e.g "" or "", it always return error "Target host must not be null"
But when i convert into IP Address, all works well.
Would you be able to advice?

public void run() {
			Log.i("GList", "downloadProcess run()");
			props = new Properties();
			try {
				String url;
				url = ""; //THIS IS FAILED
				//url = ""; // THIS IS OK
				HttpManager.doGet(url, props);
			} catch (Exception e) {
				// TODO Auto-generated catch block
			// TODO Auto-generated method stub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>HttpManager.doGet(url, props);

What's that? It's not Apache HttpClient..
isuhendroAuthor Commented:
HttpManager just a wrapper of Apache HTTP client, please refer to the static method inside HttpManager below.
	public static String doGet (String serviceEndpoint, Properties props) throws Exception
		HttpClient httpClient = new DefaultHttpClient();
		StringBuilder uriBuilder = new StringBuilder(serviceEndpoint);
		StringBuffer sbResponse = new StringBuffer ();		
		Enumeration<Object> enumProps = props.keys();
		String key, value = null;
		if (enumProps.hasMoreElements()) uriBuilder.append('?');
		while (enumProps.hasMoreElements())
			key = (String)enumProps.nextElement();
			value = (String)props.get(key);
		HttpGet request = new HttpGet(uriBuilder.toString());
	HttpResponse response = httpClient.execute(request);

Open in new window

>>But when i convert into IP Address, all works well.

Sounds like a DNS error. Have you tried running your code on another network?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isuhendroAuthor Commented:
hi CEHJ,

thank you for your suggestion.
somehow this line gave invalid form URL
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.