Hi and I have made a simple Java function/method and for some reason it is not working. It doesn't show errors. It doesn't display results. It returns nothing and forces other things around it to do nothing. Below is my script.
private String get_url(String address) {
String result="";
try {
URL yahoo = new URL(address);
URLConnection yahooConnection = yahoo.openConnection();
//DataInputStream dis = new DataInputStream(yahooConnection.getInputStream());
BufferedReader dis = new BufferedReader(new InputStreamReader(yahooConnection.getInputStream()));
String inputLine;
while ((inputLine = dis.readLine()) != null) {
result=result+inputLine+"\n";
}
dis.close();
} catch (MalformedURLException me) {
} catch (IOException ioe) {
}
return result;
}
And to call it I used the following:
jTextArea1.setText("-"+get_url("http://google.com.au/"));
But yet it doesn't even show that dash. And as soon as I remove the get_url() function the dash will display. It should display the html code of Googles homepage. Can anybody see what is wrong with my code as there are no errors reported and the function just won't display the html code...