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?
 
moduloConnect With a Mentor Commented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
All Courses

From novice to tech pro — start learning today.