I am currently trying to develop an application using netbeans 6.9.1, but when I try to run the program I am getting the following error
Uncaught exception: java.lang.IllegalArgumentException
at javax.microedition.io.Connector.openPrim(), bci=31
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=2
at RSSParser$1.run(RSSParser.java:32)
this error is coming from this code
public void parse(final String url) {
Thread t = new Thread() {
public void run() {
// set up the network connection
HttpConnection hc = null;
try {
hc = (HttpConnection)Connector.open(url);
parse(hc.openInputStream());
}
catch (IOException ioe) {
mRSSListener.exception(ioe);
}
finally {
try { if (hc != null) hc.close(); }
catch (IOException ignored) {}
}
}
};
t.start();
}
This method is being called from another class here
public void startApp() {
if (mDisplay == null)
mDisplay = Display.getDisplay(this);
if (mInitialized == false) {
// Put up the waiting screen.
Screen waitScreen = new Form("Connecting...");
mDisplay.setCurrent(waitScreen);
// Create the title list.
mTitleList = new List("Headlines", List.IMPLICIT);
mExitCommand = new Command("Exit", Command.EXIT, 0);
mDetailsCommand = new Command("Details", Command.SCREEN, 0);
mTitleList.addCommand(mExitCommand);
mTitleList.addCommand(mDetailsCommand);
mTitleList.setCommandListener(this);
// Start parsing.
String url = getAppProperty("RSSMIDlet.URL");
RSSParser parser = new RSSParser();
parser.setRSSListener(this);
parser.parse(url);
mInitialized = true;
}
else
mDisplay.setCurrent(mTitleList);
}
When I debug it, it is saying the "String url" is null, how do I solve this?
I have also put a url in the string url like so:
String url = getAppProperty("RSSMIDlet.http://wwww.anything.com");
String url = getAppProperty("http://wwww.anything.com");
but this shouldn't matter as the first way has a default url to go to.
Does anybody know what I am doing wrong here?