Skip to content

Commit 7436a77

Browse files
turbanoffPankaj Bansal
authored andcommitted
8274317: Unnecessary reentrant synchronized block in java.awt.Cursor
Reviewed-by: serb, pbansal, prr
1 parent 7426fd4 commit 7436a77

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/java.desktop/share/classes/java/awt/Cursor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,7 @@ public static Cursor getSystemCustomCursor(final String name)
295295
Cursor cursor = systemCustomCursors.get(name);
296296

297297
if (cursor == null) {
298-
synchronized(systemCustomCursors) {
299-
if (systemCustomCursorProperties == null)
300-
loadSystemCustomCursorProperties();
301-
}
298+
loadSystemCustomCursorProperties();
302299

303300
String prefix = CURSOR_DOT_PREFIX + name;
304301
String key = prefix + DOT_FILE_SUFFIX;
@@ -433,7 +430,10 @@ public String toString() {
433430
*/
434431
@SuppressWarnings("removal")
435432
private static void loadSystemCustomCursorProperties() throws AWTException {
436-
synchronized(systemCustomCursors) {
433+
synchronized (systemCustomCursors) {
434+
if (systemCustomCursorProperties != null) {
435+
return;
436+
}
437437
systemCustomCursorProperties = new Properties();
438438

439439
try {

0 commit comments

Comments
 (0)