Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Bad Class Access Flags Alert  RSS feed

 
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!