I get this error while accessing a php script:
W/System.err: Error reading from ./org/apache/harmony/awt/www/content/text/html.class
The offending code snippet is as follows:
URL url = "http://server.com/path/to/script"
is = (InputStream) url.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
The error is thrown on the second line. A Google search on the error turned up 0 results. This warning doesn’t affect the flow of my application and its more an annoyance rather than a problem. it also only occurs on a API 11 device (works fine on API 8 & 9 devices)
If you’re querying a PHP script, I’m pretty sure declaring a URL and then trying to get an InputStream off it isn’t the right way to do it…
Try something like:
And for easily converting the stream to a string, just call this method: