Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file read/write permissions

 
John Mack
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, my question is:
In the server (or client) security policy file, do you have to give the db.db file a java.io.FilePermission setting?
I pass the location (as a full pathname) of the db.db file on the command line so that I can create a Data object. If I don't specify the full pathname of this file in the security policy file I get a 'java.security.AccessControlException: access denied (java.io.FilePermission..'
The problem is that the specification states 'allow the user to specify the location of the database', so if they move the database, the location will differ from the location in the policy file, and this exception will occur. Is there any way of setting policy file attributes after starting the program, or is there another way of making sure there is access to the file, wherever it is, without using 'permission java.security.AllPermission' which I don't think is a good idea.
please advise!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just put one permission in my policy file that gave full access to everything.
grant {
permission java.security.AllPermission "", "";
};

I didn't lose points for it.
Mark
 
John Mack
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,
thanks for your reply. I have got a policy file now that basically allows all access to the files below the current user directory. But,if it goes pear-shaped it's good to know I can use the simple permission and not lose marks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic