< prev index next >
src/share/classes/sun/swing/SwingUtilities2.java
Print this page
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov
*** 448,458 ****
if (availTextWidth <= 0) {
//can not fit any characters
return clipString;
}
! boolean needsTextLayout = false;
synchronized (charsBufferLock) {
if (charsBuffer == null || charsBuffer.length < stringLength) {
charsBuffer = string.toCharArray();
} else {
--- 448,458 ----
if (availTextWidth <= 0) {
//can not fit any characters
return clipString;
}
! boolean needsTextLayout;
synchronized (charsBufferLock) {
if (charsBuffer == null || charsBuffer.length < stringLength) {
charsBuffer = string.toCharArray();
} else {
*** 703,717 ****
cellBounds.height = itemSize.height;
// See if coords are inside
// ASSUME: mouse x,y will never be < cell's x,y
assert (p.x >= cellBounds.x && p.y >= cellBounds.y);
! if (p.x > cellBounds.x + cellBounds.width ||
! p.y > cellBounds.y + cellBounds.height) {
! return true;
! }
! return false;
}
/**
* Set the lead and anchor without affecting selection.
*/
--- 703,714 ----
cellBounds.height = itemSize.height;
// See if coords are inside
// ASSUME: mouse x,y will never be < cell's x,y
assert (p.x >= cellBounds.x && p.y >= cellBounds.y);
! return p.x > cellBounds.x + cellBounds.width ||
! p.y > cellBounds.y + cellBounds.height;
}
/**
* Set the lead and anchor without affecting selection.
*/
*** 1227,1242 ****
* @param ie InputEvent to get the field from
*/
private static synchronized boolean inputEvent_canAccessSystemClipboard(InputEvent ie) {
if (inputEvent_CanAccessSystemClipboard_Field == null) {
inputEvent_CanAccessSystemClipboard_Field =
! (Field)AccessController.doPrivileged(
! new java.security.PrivilegedAction() {
! public Object run() {
! Field field = null;
try {
! field = InputEvent.class.
getDeclaredField("canAccessSystemClipboard");
field.setAccessible(true);
return field;
} catch (SecurityException e) {
} catch (NoSuchFieldException e) {
--- 1224,1238 ----
* @param ie InputEvent to get the field from
*/
private static synchronized boolean inputEvent_canAccessSystemClipboard(InputEvent ie) {
if (inputEvent_CanAccessSystemClipboard_Field == null) {
inputEvent_CanAccessSystemClipboard_Field =
! AccessController.doPrivileged(
! new java.security.PrivilegedAction<Field>() {
! public Field run() {
try {
! Field field = InputEvent.class.
getDeclaredField("canAccessSystemClipboard");
field.setAccessible(true);
return field;
} catch (SecurityException e) {
} catch (NoSuchFieldException e) {
*** 1420,1433 ****
* Class.getResource a security risk because it
* can be used to load additional classes.
* Class.getResourceAsStream just returns raw
* bytes, which we can convert to an image.
*/
! byte[] buffer = (byte[])
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction() {
! public Object run() {
try {
InputStream resource = null;
Class<?> srchClass = baseClass;
while (srchClass != null) {
--- 1416,1429 ----
* Class.getResource a security risk because it
* can be used to load additional classes.
* Class.getResourceAsStream just returns raw
* bytes, which we can convert to an image.
*/
! byte[] buffer =
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<byte[]>() {
! public byte[] run() {
try {
InputStream resource = null;
Class<?> srchClass = baseClass;
while (srchClass != null) {
< prev index next >