0
我得到一個java.lang.IllegalStateException: Target host must not be null, or set in parameters
錯誤。在做makeHttpRequest時是新行字符,還是我在這裏的錯誤路徑上? 代碼:makeHttpRequest中的換行符
String url = "http://www.<myDomain>.co.za/insertTeamResultwithCode.php?Code="+code+
"&Section="+section+
"&Gender="+gender+
"&WinningTeam="+newResult.getWinningTeam()+
"&LosingTeam="+newResult.getLosingTeam()+
"&FixtureD="+newResult.getDate()+
"&FixtureT="+newResult.getTime()+
"&Venue="+newResult.getVenue()+
"&Court="+newResult.getCourt()+
"&Texts="+newResult.getText();
try
{
String encodedUrl = URLEncoder.encode(url, "UTF-8");
JSONParser jParser = new JSONParser();
JSONObject json = jParser.makeHttpRequest(encodedUrl, "GET", isSuccessfull);
try
{
boolean success = (json.getBoolean("isValid"));
DisplayToast(success);
}
catch (JSONException d)
{
d.printStackTrace();
}
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
而且logcat的錯誤:
05-29 06:55:49.230: E/AndroidRuntime(25416): java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=http://www.<myDomain>.co.za/insertTeamResultwithCode.php?Code=masjiensquash2015&Section=A&Gender=Men&WinningTeam=KZN&LosingTeam=WP&FixtureD=2015-05-29&FixtureT=09:00:00&Venue=Potch+CC&Court=1&Texts=mufasa+(KZN)+beat+scar+(WP)+3-0
05-29 06:55:49.230: E/AndroidRuntime(25416): (11-8,+11-6,+11-4)
05-29 06:55:49.230: E/AndroidRuntime(25416): optimus+(KZN)+beat+megatron+(WP)+3-0
05-29 06:55:49.230: E/AndroidRuntime(25416): (11-6,+11-3,+11-8)
05-29 06:55:49.230: E/AndroidRuntime(25416): Chuck+(KZN)+beat+Larry+(WP)+3-0
05-29 06:55:49.230: E/AndroidRuntime(25416): (11-5,+11-4,+11-4)
05-29 06:55:49.230: E/AndroidRuntime(25416): Tiger+(KZN)+beat+Rory+(WP)+3-0
05-29 06:55:49.230: E/AndroidRuntime(25416): (11-6,+11-3,+11-6)
05-29 06:55:49.230: E/AndroidRuntime(25416): Zandre+(KZN)+beat+Anzelle+(WP)+3-0
05-29 06:55:49.230: E/AndroidRuntime(25416): (11-5,+11-6,+11-2)