Solved

GetPropertyAction in java 1.5

Posted on 2004-10-18
8
354 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:oleber
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12337282
Can you do:

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

?

Not sure it will work though...
0
 
LVL 10

Author Comment

by:oleber
ID: 12337339
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
 
LVL 35

Expert Comment

by:TimYates
ID: 12337401
How about:

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

The new typed parameters hurt my head ;-)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 86

Expert Comment

by:CEHJ
ID: 12339013
I don't know those classes but you can of course simply ignore the warnings ;-)
0
 
LVL 10

Author Comment

by:oleber
ID: 12356781
This will be points to me :)

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

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12356938
Well i assumed you needed to check access to that property ;-)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12808007
PAQed with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question