Solved

GetPropertyAction in java 1.5

Posted on 2004-10-18
8
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
going to wrong jsp page 2 46
add projects t working set in maven 2 37
glassfish admin console 1 18
Java array 10 55
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 …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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…

740 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