| Reply | « Previous Thread | Next Thread » |
|
Hi all,
Need some feedbacks and advise. I have written a midlet that capture images and want to save the captured image into the phone memory card but have encountered Security Exception on the midlet. My midlet is tested on a N6280 with a memory card installed. The midlet is signed with a Thawte certificate and I have set the "Add and edit data" within "Application access" to "Always allowed". I'm clueless on how to overcome this problem, any help would be appreciated. regards Jason |
| break10ose |
| View Public Profile |
| Find all posts by break10ose |
|
Try checking where the photos are stored and use that directory. For this use System.getProperty("fileconn.dir.photos")
Hartti |
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
hi Jason,
follow Hartti's suggestions, even if you have midlet signed with 3rd party certificate it does not mean that you can write file into some locations on phone (because some folders access can be restricted unless midlet is signed with manufacturer-released certificate), so instead using hardcoded values use property mentioned, also always provide check with: [FileConnection].canWrite() method before writing data into file, see java doc for JSR-75 for details hth, regards, Peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
|
Thanks Hatti & Peter,
I did just that, I did a canWrite() check before trying to create the directory or file. I am trying to write to the media card and not to the phone memory. I will try to use the System.getProperty("fileconn.dir.photos") as the directory to create image files to save the captured image from the phone camera. The confusing part is that the value returned from System.getProperty("fileconn.dir.photos") match that of the actual phone directory names. I will post my result later. Thanks again for your advises. regards Jason |
| break10ose |
| View Public Profile |
| Find all posts by break10ose |
|
Hi guys,
I have tested with the following System properties to try create a file but keep getting Security Exception error. String photodir = System.getProperties("fileconn.dir.photos.name"); OR System.getProperty("fileconn.dir.memorycard"); OR System.getProperty("fileconn.dir.photos"); I use the following code that hit the Security Exception error: try { FileConnection fc = (FileConnection) Connector.open(photodir + filename, Connector.READ_WRITE); if (fc.canWrite()) { if (!fc.exists()) { fc.create(); } fc.close(); } } catch (IOException e) { System.out.println(e); } catch (SecurityException se) { System.out.println(se); } If I replace Connector.READ_WRITE to Connector.READ then I will be prompted to allow read to the directory. Any suggestions? regards Jason |
| break10ose |
| View Public Profile |
| Find all posts by break10ose |
|
Hi all,
Found out the problem that is troubling me with this FileConnection security exception. The problem is with the IDE that I use to compile the midlet, NetBeans 5.0. They have typo error in their javax.microedition.io.Connector.file.write API which happened to have an extra trailing blank space, thus preventing user from putting in file.write permission on their midlet before compilation. If you are having similar problem as mine, the work around is to download and install NetBeans 5.5 (Beta 2). You will still need to have the midlet signed for it to work perfectly. regards Jason |
| break10ose |
| View Public Profile |
| Find all posts by break10ose |
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
Hello,
just to close topic: link to MobilityPack issues list with this bug description: http://www.netbeans.org/issues/show_bug.cgi?id=71534 regards, Peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problem MMC+USB Connection | Fede81 | General Symbian C++ | 1 | 2007-06-14 07:13 |
| VS.Net 2003 Carbide 2.01 and epoc32.exe | ValentinK | Carbide.c++ IDE and plug-ins | 2 | 2007-01-12 13:31 |
| Problem MMC+USB Connection | Fede81 | General Discussion | 3 | 2006-07-19 16:21 |
| SIP content type | hlothman | Symbian Networking & Messaging | 8 | 2006-05-17 10:26 |
| can not successfully link any sample using .NET | lobotomat | Symbian Tools & SDKs | 2 | 2002-08-20 01:29 |