[Logo]
Forums Register Login
Bad Class Access Flags Alert
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.");
}
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 21, 2017 22:55:44.