Greetings to all, there may be a stupid question.

I open the input form through:

View.VISIBLE 

Next, I enter the text in EditText - I check the fields for emptiness through isEmpty. Next, the data is sent to the server, go fine - provided that there was no transfer of text, if you click on the transfer of text, then fatal error falls out.

Can anyone come across this?

UPD 02/19/12. Scored at night looking class with the httpGet method:

  package meo.app.pigeon; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; public class getPost { public String API_URL = "http://tjuryakin.ru/pigeon/api.php"; public String DATA = ""; public String RESULT_DB_POST = ""; public String dbPost(String DATA) { String proxyHost = android.net.Proxy.getDefaultHost(); int proxyPort = android.net.Proxy.getDefaultPort(); HttpClient httpClient = new DefaultHttpClient(); if (proxyPort > 0) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } HttpGet httpGet = new HttpGet(API_URL + "?" + DATA); try { HttpResponse response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { RESULT_DB_POST = "access"; } else { RESULT_DB_POST = "error"; } } catch (Exception e) { RESULT_DB_POST = e.toString(); } return RESULT_DB_POST; } public static final String md5(final String s) { try { // Create MD5 Hash MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) { String h = Integer.toHexString(0xFF & messageDigest[i]); while (h.length() < 2) h = "0" + h; hexString.append(h); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return ""; } } 
  • what else fatal error? Stack to Studio - LackOfKnowledge
  • Maybe because of the difference in \r\n and \n the parser is broken? Is the server side covered with tests? - Costantino Rupert

1 answer 1

 java.lang.IllegalArgumentException: Illegal character in query at index 

So? It is necessary to screen DATA. See Allowed characters in URL parts.

 HttpGet httpGet = new HttpGet(API_URL + "?"+ URLEncoder.encode(DATA,"UTF-8"));