Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to resolve FileNotFoundException incase HttpURLConnection
    primarykey
    data
    text
    <p>I hava an application where I am sending sms via POST method, This method working fine but some time giving FileNotFound Exception. Please any one tell me Whats the problem.</p> <p>Below is my code. Thanks </p> <pre><code> public static String sendSMS(String data, String url1) { URL url; String status = "Somthing wrong "; try { url = new URL(url1); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("charset", "utf-8"); connection.setRequestProperty("Content-Length", "" + Integer.toString(data.getBytes().length)); connection.setUseCaches (false); DataOutputStream wr = new DataOutputStream(connection.getOutputStream ()); wr.writeBytes(data); wr.flush(); wr.close(); connection.disconnect(); // Get the response try { BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream())); String s; while ((s = rd.readLine()) != null) { status = s; } rd.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } catch (MalformedURLException e) { status = "MalformedURLException Exception in sendSMS"; e.printStackTrace(); } catch (IOException e) { status = "IO Exception in sendSMS"; e.printStackTrace(); } return status; } </code></pre> <p>The Error What I got </p> <blockquote> <p>java.io.FileNotFoundException: http://.... at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload