02-15-2011 09:22 AM
Hi. I'm having more and more trouble trying to get my code to work. It seems that I'm always getting a nullpointerexception, after having checked my code about 10 times and finding nothing wrong. The thing is when I try and debug it, the debugger seems to stop when it wants and says "source not found". What does this error mean?? I'm wasting time trying to figure out where my nullpointerexception is coming from because I can't even debug. Thanks in advance.
02-15-2011 09:40 AM
Are you sure it isn't the debugger stopping when the NullPointerException is thrown? If it's similar to this http://supportforums.blackberry.com/t5/BlackBerry-
If that isn't the case, can you post some code where you think it's happening?
02-15-2011 10:29 AM
I think that the error might be coming from this method. Thanks.
public void createTripButtons(Database db)// throws Exception
Vector myTrips = new Vector();
// Read in all records from tblTrips
Statement statement = db.createStatement("SELECT * FROM tblTrips");
Cursor cursor = statement.getCursor();
// Iterate through the the result set. For each row, add a
// new TripItem object to the vector.
Row row = cursor.getRow();
String aPnrID = row.getString(0);
GTGTrip item = new GTGTrip(aPnrID);
02-15-2011 11:07 AM
About "source not found" you have to click on a button and specify yourself your project's URI on worskpace where your source are.
Have you tryed catching a NullPointerException on this method?
02-15-2011 02:07 PM
I think I've solved my problem (as in my code is working). Still not too sure how the "source not found" thing works but it may have something to do with putting breakpoints on statements that need to be signed, like a lot of the Database methods. The reason my program wasn't working was mainly because I was calling row.getString() when the value of that field was "1". It is a VARCHAR in the database but for some reason it wouldn;t recognize it as a string. I had to say getInteger() instead and it seems to be working fine. Well, back to work (until the next problem arises of course). Thanks for your time.
02-15-2011 02:39 PM
"Source not found" occurs when you throw an exception in a module that has no source on your system. This might happen (for example) when you are failing to initialize something correctly, causing a RIM conponent to throw the NullPointerException.