GetPropertyAction in java 1.5

String strTmpdir = ((String) AccessController.doPrivileged(new GetPropertyAction("java.io.tmpdir")));

I'm using NETBeans and I have this warning
...\JIntFrmRunTests.java:266: warning: [unchecked] unchecked conversion
found   : sun.security.action.GetPropertyAction
required: java.security.PrivilegedAction<T>
                            String strTmpdir = ((String) AccessController.doPrivileged(new GetPropertyAction("java.io.tmpdir")));

What shall I do to remove this warning?

thanks
MArcos
LVL 10
oleberAsked:
Who is Participating?
 
moduloCommented:
PAQed with points refunded (50)

modulo
Community Support Moderator
0
 
TimYatesCommented:
Can you do:

String strTmpdir = AccessController.doPrivileged(new GetPropertyAction<String>("java.io.tmpdir")) ;

?

Not sure it will work though...
0
 
oleberAuthor Commented:
Nope

...\JIntFrmRunTests.java:267: type sun.security.action.GetPropertyAction does not take parameters
                            String strTmpdir = AccessController.doPrivileged(new GetPropertyAction<String>("java.io.tmpdir")) ;
1 error
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
TimYatesCommented:
How about:

String strTmpdir = AccessController<String>.doPrivileged(new GetPropertyAction("java.io.tmpdir")) ;

The new typed parameters hurt my head ;-)
0
 
CEHJCommented:
I don't know those classes but you can of course simply ignore the warnings ;-)
0
 
oleberAuthor Commented:
This will be points to me :)

Why not use 'System.getProperty("java.io.tmpdir")'?

0
 
CEHJCommented:
Well i assumed you needed to check access to that property ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.