• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

give me permission

 
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use java.lang.reflect.ReflectPermission
I am trying to modify a String object
this is my code
policy file contents
=======================
grant {
// permission java.lang.reflect.ReflectPermission "suppressAccessChecks","";
permission java.security.AllPermission;
};
grant codeBase "file:///D:/java/test"{
permission java.lang.reflect.ReflectPermission "suppressAccessChecks","";
permission java.security.AllPermission;
};
==============================
batch file says
----------------
java -Djava.security.manager -Djava.security.policy=reflect.policy ChangeString
PAUSE
--------------------

[ September 26, 2002: Message edited by: Kalpesh Soni ]
 
Kalpesh Soni
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh i found it out :roll:
and something else too
changing my C:\j2sdk1.4.0\jre\lib\security\java.policy and entering
//ksoni added entry
permission java.lang.reflect.ReflectPermission "suppressAccessChecks","";
works.........
but creating / editing
C:\Documents and Settings\ksoni\java.policy
does not work
I guess it has some problem with the space in
"Documents and Settings"

[ September 26, 2002: Message edited by: Kalpesh Soni ]
 
Kalpesh Soni
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh [expletive deleted]
this also works without any policy file settings

[ September 26, 2002: Message edited by: Thomas Paul ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool .
I am going to transfer this to the Security forum.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kalpesh Soni:
oh [expletive deleted]
this also works without any policy file settings

[ September 26, 2002: Message edited by: Thomas Paul ]


It worked for me too, but shouldn't you get a SecurityException at getDeclaredField() theoretically ? The field must be private and we are still able to get it !
 
Kalpesh Soni
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmmm
the catch here is that there is not security manager ! so who will give you security exception

try running
java -Djava.security.manager ChangeString
and you will get
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic