You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy Security Exception on N6280 for creating directory on media card - 2006-07-25, 11:30

Join Date: Mar 2003
Posts: 23
Location: Singapore
break10ose
Offline
Registered User
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
Reply With Quote

#2 Old Re: Security Exception on N6280 for creating directory on media card - 2006-07-25, 19:27

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
Try checking where the photos are stored and use that directory. For this use System.getProperty("fileconn.dir.photos")

Hartti
Reply With Quote

#3 Old Re: Security Exception on N6280 for creating directory on media card - 2006-07-26, 00:36

Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
peterblazejewicz
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
Reply With Quote

#4 Old Re: Security Exception on N6280 for creating directory on media card - 2006-07-26, 02:32

Join Date: Mar 2003
Posts: 23
Location: Singapore
break10ose
Offline
Registered User
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
Reply With Quote

#5 Old Re: Security Exception on N6280 for creating directory on media card - 2006-07-26, 04:15

Join Date: Mar 2003
Posts: 23
Location: Singapore
break10ose
Offline
Registered User
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
Reply With Quote

#6 Old Smile Re: Security Exception on N6280 for creating directory on media card - 2006-07-26, 07:56

Join Date: Mar 2003
Posts: 23
Location: Singapore
break10ose
Offline
Registered User
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
Reply With Quote

#7 Old Re: Security Exception on N6280 for creating directory on media card - 2006-08-01, 01:28

Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
peterblazejewicz
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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ