jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
changeset 30479 09cccadb5831
parent 30471 c1568a2416a8
child 30948 0a0972d3b58d
equal deleted inserted replaced
30478:eaa3acedbdde 30479:09cccadb5831
   841     protected static boolean imageCached(Object key) {
   841     protected static boolean imageCached(Object key) {
   842         return imgCache.containsKey(key);
   842         return imgCache.containsKey(key);
   843     }
   843     }
   844 
   844 
   845     protected static boolean imageExists(String filename) {
   845     protected static boolean imageExists(String filename) {
   846         checkPermissions(filename);
   846         if (filename != null) {
   847         return filename != null && new File(filename).exists();
   847             checkPermissions(filename);
       
   848             return new File(filename).exists();
       
   849         }
       
   850         return false;
   848     }
   851     }
   849 
   852 
   850     @SuppressWarnings("try")
   853     @SuppressWarnings("try")
   851     protected static boolean imageExists(URL url) {
   854     protected static boolean imageExists(URL url) {
   852         checkPermissions(url);
       
   853         if (url != null) {
   855         if (url != null) {
       
   856             checkPermissions(url);
   854             try (InputStream is = url.openStream()) {
   857             try (InputStream is = url.openStream()) {
   855                 return true;
   858                 return true;
   856             }catch(IOException e){
   859             }catch(IOException e){
   857                 return false;
   860                 return false;
   858             }
   861             }