Forums Register Login

Bad Class Access Flags Alert

+Pie Number of slices to send: Send
When a wrote the code below in a midlet the Bad Class Access Flag Alert occurs in Runtime and the programme stops. What is the reason for that? What does Bad Class Access Flags Alert mean? Is anyone can inform me? I am going mad...

public static void testURLConnectionCommunication(int numAttempts) {
System.out.println("Necati");
boolean failed = false;
for (int i=0; i<numAttempts; i++) {
HttpURLConnection conn = null;
System.out.println("2");
InputStream is = null;
System.out.println("3");
URL url;
try {
url = new URL("http://www.google.com");
System.out.println("4");
System.out.println("Connection to " + url + ":");
conn = (HttpURLConnection)url.openConnection();
System.out.println("5");
conn.setAllowUserInteraction(false);
conn.setDoInput(true);
conn.setDoOutput(false);
conn.connect();
is = conn.getInputStream();
byte[] buf = new byte[4096];
int len;
while ((len = is.read(buf)) != -1) {
System.out.print(new String(buf, 0, len));
}
} catch (IOException e) {
System.out.println("URLConnection test failed on attempt " + i + ":");
e.printStackTrace();
failed = true;
break;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
System.out.println("Unable to close input stream: " + e.getMessage());
}
}
if (conn != null) {
conn.disconnect();
}
}
System.out.println();
} if (!failed) System.out.println("URLConnection test passed.");
}
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 923 times.
Similar Threads
post html login
httpclient athentification issue
datastream with additional parameter
creating a link
URLConnection problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 23:47:42.