< prev index next >
src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java
Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>
*** 2099,2110 ****
* <code>soundFile</code> filename. If this method is unable to
* build a viable path name from the <code>baseClass</code> and
* <code>soundFile</code> passed into this method, it will
* return <code>null</code>.
*
- * @param baseClass used as the root class/location to get the
- * soundFile from
* @param soundFile the name of the audio file to be retrieved
* from disk
* @return A byte[] with audio data or null
* @since 1.4
*/
--- 2099,2108 ----
*** 2117,2129 ****
* Class.getResource a security risk since it
* can be used to load additional classes.
* Class.getResourceAsStream just returns raw
* bytes, which we can convert to a sound.
*/
! byte[] buffer = (byte[])AccessController.doPrivileged(
! new PrivilegedAction() {
! public Object run() {
try {
InputStream resource = BasicLookAndFeel.this.
getClass().getResourceAsStream(soundFile);
if (resource == null) {
return null;
--- 2115,2127 ----
* Class.getResource a security risk since it
* can be used to load additional classes.
* Class.getResourceAsStream just returns raw
* bytes, which we can convert to a sound.
*/
! byte[] buffer = AccessController.doPrivileged(
! new PrivilegedAction<byte[]>() {
! public byte[] run() {
try {
InputStream resource = BasicLookAndFeel.this.
getClass().getResourceAsStream(soundFile);
if (resource == null) {
return null;
*** 2181,2193 ****
if (audioAction != null) {
Object[] audioStrings = (Object[])
UIManager.get("AuditoryCues.playList");
if (audioStrings != null) {
// create a HashSet to help us decide to play or not
! HashSet audioCues = new HashSet();
! for (int i = 0; i < audioStrings.length; i++) {
! audioCues.add(audioStrings[i]);
}
// get the name of the Action
String actionName = (String)audioAction.getValue(Action.NAME);
// if the actionName is in the audioCues HashSet, play it.
if (audioCues.contains(actionName)) {
--- 2179,2191 ----
if (audioAction != null) {
Object[] audioStrings = (Object[])
UIManager.get("AuditoryCues.playList");
if (audioStrings != null) {
// create a HashSet to help us decide to play or not
! HashSet<Object> audioCues = new HashSet<Object>();
! for (Object audioString : audioStrings) {
! audioCues.add(audioString);
}
// get the name of the Action
String actionName = (String)audioAction.getValue(Action.NAME);
// if the actionName is in the audioCues HashSet, play it.
if (audioCues.contains(actionName)) {
*** 2234,2244 ****
/**
* This class contains listener that watches for all the mouse
* events that can possibly invoke popup on the component
*/
! class AWTEventHelper implements AWTEventListener,PrivilegedAction {
AWTEventHelper() {
super();
AccessController.doPrivileged(this);
}
--- 2232,2242 ----
/**
* This class contains listener that watches for all the mouse
* events that can possibly invoke popup on the component
*/
! class AWTEventHelper implements AWTEventListener,PrivilegedAction<Object> {
AWTEventHelper() {
super();
AccessController.doPrivileged(this);
}
< prev index next >