Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 1
Registered: ‎05-11-2010
My Device: Bold 9700
My Carrier: MTN

FileSystemJournalEntry showing as null on device but works on Simulator

[ Edited ]

Hi Guys,


I've done quite a bit of searching but can't seem to find a solution to this problem. I have a suspicion its environment based over code but any help would be greatly appreciated.


I have an application that has a option to take a snapshot and upload it to a webservice. I'm using the native camera application on the device ( this if for a Bold 9700 btw ). On my main screen either  button or a menu option fires off an invocation of the camera app as in the example below:


else if (field==uploadImages)
  	ImageFileListener listener = new ImageFileListener();
	Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments(CameraArguments.ARG_CAMERA_APP));

 This is a sample of the code fired from within my fieldChanged event.


As you can see I've attached the listener which is pretty much the defacto code sample in all examples I've seen and other queries. The listener does fire and I am able to step through the code in the listener.


public class ImageFileListener implements FileSystemJournalListener
   private long lastChangeNumber = 0;

    public void fileJournalChanged() 
        long nextChangeNumber = FileSystemJournal.getNextUSN();
        long change;
        for (change = (nextChangeNumber-1); change >=  lastChangeNumber && change < nextChangeNumber; --change)
	  FileSystemJournalEntry entry = FileSystemJournal.getEntrychange);

if (path==null)


if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED) { String path = entry.getPath(); if (path != null && path.indexOf(".jpg") != -1) { UiApplication.getUiApplication().requestForeground(); closeCamera(path); UploadScreen screen = new UploadScreen(path); UiApplication.getUiApplication().pushScreen(screen); break; } } } lastChangeNumber = nextChangeNumber; } }


Everything works on the simulator, the camera app opens, I take a snapshot and the path is passed to my upload screen where the file read and converted into a field for checking before proceeding.


BUT on the device, it seems to hang. Stepping through the code, it goes to the listener and then the strange things start happening, The entry is always null when I watch it or stop at a breakpoint, even when it actually goes into the code to fire off the new screen, the ide still says that entry is null. The device doesn't crash, it just returns to the prior screen that fired off the camera app.


Anyone have any ideas how I can solve this or suggestions in checking that my environment is correct. The balance of the application works fine on the device, it seems to only be an issue when I'm debugging on it with the camera.

Posts: 13
Registered: ‎03-30-2010
My Device: 8520
My Carrier: 3

Re: FileSystemJournalEntry showing as null on device but works on Simulator

On device, when you take a picture and the picture is saved, the FileSystemJournalListener is invoked, however during this process a thumbnail is also created for your saved picture and this may retrigger the same FileSystemJournal listener to be invoked, and since you're expecting a .jpg file but this thumbnail isn't, you get a null path instead.


I once got this error, yours maybe same or different.


Best Regards,