src/java.desktop/share/classes/sun/awt/SunToolkit.java

Print this page

        

@@ -841,18 +841,21 @@
     protected static boolean imageCached(Object key) {
         return imgCache.containsKey(key);
     }
 
     protected static boolean imageExists(String filename) {
+        if (filename != null) {
         checkPermissions(filename);
-        return filename != null && new File(filename).exists();
+            return new File(filename).exists();
+        }
+        return false;
     }
 
     @SuppressWarnings("try")
     protected static boolean imageExists(URL url) {
-        checkPermissions(url);
         if (url != null) {
+            checkPermissions(url);
             try (InputStream is = url.openStream()) {
                 return true;
             }catch(IOException e){
                 return false;
             }