Skip to content

Commit 3b7571d

Browse files
author
Andrey Turbanov
committed
8345398: Avoid redundant Properties.containsKey call in Cursor.getSystemCustomCursor
Reviewed-by: aivanov, prr
1 parent ca46c3a commit 3b7571d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -295,19 +295,18 @@ public static Cursor getSystemCustomCursor(final String name)
295295
loadSystemCustomCursorProperties();
296296

297297
String prefix = CURSOR_DOT_PREFIX + name;
298-
String key = prefix + DOT_FILE_SUFFIX;
299298

300-
if (!systemCustomCursorProperties.containsKey(key)) {
299+
String fileName =
300+
systemCustomCursorProperties.getProperty(prefix + DOT_FILE_SUFFIX);
301+
302+
if (fileName == null) {
301303
if (log.isLoggable(PlatformLogger.Level.FINER)) {
302304
log.finer("Cursor.getSystemCustomCursor(" + name + ") returned null");
303305
}
304306
return null;
305307
}
306308

307-
final String fileName =
308-
systemCustomCursorProperties.getProperty(key);
309-
310-
final String localized = systemCustomCursorProperties.getProperty(
309+
String localized = systemCustomCursorProperties.getProperty(
311310
prefix + DOT_NAME_SUFFIX, name);
312311

313312
String hotspot = systemCustomCursorProperties.getProperty(prefix + DOT_HOTSPOT_SUFFIX);

0 commit comments

Comments
 (0)