From eef156180c772a042416fc35d86072e722519f0b Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 21 Nov 2024 16:02:28 +0000 Subject: [PATCH] 8344569: SwingUtilities2.makeIcon_Unprivileged is obsolete Reviewed-by: psadhukhan --- .../classes/javax/swing/LookAndFeel.java | 2 +- .../classes/sun/swing/SwingUtilities2.java | 36 +------------------ 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/java.desktop/share/classes/javax/swing/LookAndFeel.java b/src/java.desktop/share/classes/javax/swing/LookAndFeel.java index 830fadb1c0c..4d31dc9aa02 100644 --- a/src/java.desktop/share/classes/javax/swing/LookAndFeel.java +++ b/src/java.desktop/share/classes/javax/swing/LookAndFeel.java @@ -469,7 +469,7 @@ public abstract class LookAndFeel * @see Class#getResourceAsStream(String) */ public static Object makeIcon(final Class baseClass, final String gifFile) { - return SwingUtilities2.makeIcon_Unprivileged(baseClass, baseClass, gifFile); + return SwingUtilities2.makeIcon(baseClass, baseClass, gifFile); } /** diff --git a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java index 2613ca326ea..eb35920aad0 100644 --- a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java +++ b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java @@ -1671,42 +1671,8 @@ public class SwingUtilities2 { public static Object makeIcon(final Class baseClass, final Class rootClass, final String imageFile) { - return makeIcon(baseClass, rootClass, imageFile, true); - } - - /** - * Utility method that creates a {@code UIDefaults.LazyValue} that - * creates an {@code ImageIcon} {@code UIResource} for the - * specified image file name. The image is loaded using - * {@code getResourceAsStream}, starting with a call to that method - * on the base class parameter. If it cannot be found, searching will - * continue through the base class' inheritance hierarchy, up to and - * including {@code rootClass}. - * - * Finds an image with a given name without privileges enabled. - * - * @param baseClass the first class to use in searching for the resource - * @param rootClass an ancestor of {@code baseClass} to finish the - * search at - * @param imageFile the name of the file to be found - * @return a lazy value that creates the {@code ImageIcon} - * {@code UIResource} for the image, - * or null if it cannot be found - */ - public static Object makeIcon_Unprivileged(final Class baseClass, - final Class rootClass, - final String imageFile) { - return makeIcon(baseClass, rootClass, imageFile, false); - } - - private static Object makeIcon(final Class baseClass, - final Class rootClass, - final String imageFile, - final boolean enablePrivileges) { return (UIDefaults.LazyValue) (table) -> { - byte[] buffer = enablePrivileges ? - getIconBytes(baseClass, rootClass, imageFile) - : getIconBytes(baseClass, rootClass, imageFile); + byte[] buffer = getIconBytes(baseClass, rootClass, imageFile); if (buffer == null) { return null;