From 3b7571d37812472a2152f9c8cbfd2a4abdb35016 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Thu, 5 Dec 2024 09:07:15 +0000 Subject: [PATCH] 8345398: Avoid redundant Properties.containsKey call in Cursor.getSystemCustomCursor Reviewed-by: aivanov, prr --- src/java.desktop/share/classes/java/awt/Cursor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/share/classes/java/awt/Cursor.java b/src/java.desktop/share/classes/java/awt/Cursor.java index 396165e7ec8..26c4a9831c9 100644 --- a/src/java.desktop/share/classes/java/awt/Cursor.java +++ b/src/java.desktop/share/classes/java/awt/Cursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -295,19 +295,18 @@ public class Cursor implements java.io.Serializable { loadSystemCustomCursorProperties(); String prefix = CURSOR_DOT_PREFIX + name; - String key = prefix + DOT_FILE_SUFFIX; - if (!systemCustomCursorProperties.containsKey(key)) { + String fileName = + systemCustomCursorProperties.getProperty(prefix + DOT_FILE_SUFFIX); + + if (fileName == null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Cursor.getSystemCustomCursor(" + name + ") returned null"); } return null; } - final String fileName = - systemCustomCursorProperties.getProperty(key); - - final String localized = systemCustomCursorProperties.getProperty( + String localized = systemCustomCursorProperties.getProperty( prefix + DOT_NAME_SUFFIX, name); String hotspot = systemCustomCursorProperties.getProperty(prefix + DOT_HOTSPOT_SUFFIX);