Solved

GetPropertyAction in java 1.5

Posted on 2004-10-18
8
331 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now