This week's book giveaways are in the Functional Programming and Linux forums.
We're giving away four copies each of Reactive Design Patterns and Learn Linux in a Month of Lunches and have the authors on-line!
See this thread and this one for details.
Win a copy of Reactive Design Patterns this week in the Functional Programming forum
or Learn Linux in a Month of Lunches in the Linux forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bad Class Access Flags Alert

 
necati sekkeli
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.");
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!