Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    Hello everyone
    I made an application that creates a file, but always fails.
    "java.lang.SecurityException: Access denied"

    When I do Connection, have permission to write access,
    but always fails.

    "FileConnection fileConnection = (FileConnection) Connector.open("file:///C:/Data/hola.txt", Connector.READ_WRITE );"


    I think I make my application reliable, but I do not know.
    Someone can help me?

    My code:

    try
    {
    pForm.append("EscribirArchivo -");
    FileConnection fileConnection = (FileConnection) Connector.open("file:///C:/Data/hola.txt", Connector.READ_WRITE );

    if( fileConnection.exists() )
    pForm.append("Archivo existe -");
    else
    {
    pForm.append("Creando archivo -");
    fileConnection.create();
    pForm.append("Se ha creado -");
    }

    fileConnection.close();

    }
    catch(IOException e)
    {
    System.out.println("IOException in WriteToFile: " + e.toString());
    }
    catch(SecurityException e)
    {
    System.out.println("SecurityException in WriteToFile: " + e.toString());
    }


    Sorry if I write bad, I speak Spanish

  2. #2
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    As for making your app "trusted", you should start by reading this. Signing is a complicated area, and is worth avoiding if possible.

    Being "trusted" might not give you access to all parts of the file system. Trusted applications are still subject to security restrictions. There are documents and posts about this. Which parts of the file system you can access depends on the device. You didn't tell us what device you have.

    You're English is OK! But if you prefer, there is a Spanish discussion board.

    Graham.

  3. #3
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    ok thanks
    I have permission to read, because I see the folders, but I can not write

    I will read the Links

    Thanks

  4. #4
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    You cannot write all folders. You may have permission to write some folders.

  5. #5
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    for example

    I am in C:/Data/

    Code:
    FileConnection  fileConnection = (FileConnection) Connector.open("file:///C:/Data/" );
    
    if( fileConnection.canWrite())
    {
        pForm.append("YES");
    }
    else
    {
        pForm.append("NO");
    }
    The function returns true, but when I try to create the file does not work

    Code:
    fileConnection.create();

  6. #6
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    You might like to read this.

    What device are you using?

  7. #7
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    thanks a lot

    my problem was I try write in "file:///C:/Data/".

    I try in "file:///C:/Data/Images/" and it works

    Can I create a folder in Data, for my application?

    Or only C:/Data/Images?

    thanks

  8. #8
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    No, you can only access a pre-defined set of folders.

    If you tell me what device you are using, I might be able to tell you what folders you can access.

    Graham.

  9. #9
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    ok

    I am using:

    - Net Beans 6.5
    - S60 3rd Edition SDK for symbian
    - Nokia 5800
    - Java JDK 6

    thanks

  10. #10
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    OK. Your application should have access to the folders determined by:

    Code:
    System.getProperty("fileconn.dir.photos");
    System.getProperty("fileconn.dir.videos");
    System.getProperty("fileconn.dir.graphics");
    System.getProperty("fileconn.dir.tones");
    System.getProperty("fileconn.dir.music");
    System.getProperty("fileconn.dir.recordings");
    System.getProperty("fileconn.dir.memorycard");
    System.getProperty("fileconn.dir.private");
    The last of these (fileconn.dir.private) should be available on your phone, but will not be available on all.

    Graham.

  11. #11
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    Ok , thanks

    I want to save information from my application in these folders, in a file.

    Is this the best option?
    Is there a better option?

  12. #12
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    That depends on the information.

    If you want to store private information used only by your application, such as configuration settings, then use the RecordStore API (javax.microedition.rms.*).

    See this document for a comparison of FileConnection and RMS, and information about using RMS.

    Graham.

  13. #13
    Registered User joselias84's Avatar
    Join Date
    Jan 2010
    Posts
    8
    Thanks a lot

Similar Threads

  1. Do Symbian rejects the Express Signing request on any Business Development ground?
    By arpit2agrawal in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 23
    Last Post: 2009-02-19, 10:46
  2. Replies: 2
    Last Post: 2008-11-07, 12:33
  3. [Pys60, 3rd Ed.] build problems
    By MHOOO in forum Python
    Replies: 3
    Last Post: 2007-04-09, 19:00
  4. Replies: 0
    Last Post: 2006-06-04, 14:23
  5. abld make files missing
    By dalore in forum Symbian C++
    Replies: 0
    Last Post: 2003-06-13, 12:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved