jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
changeset 33852 5072049a858d
parent 32865 f9cb6e427f9e
child 34409 65ac1c8bd205
equal deleted inserted replaced
33851:8c60451ba63a 33852:5072049a858d
   659                         }
   659                         }
   660                         if (foundfile != null) {
   660                         if (foundfile != null) {
   661                             try {
   661                             try {
   662                                 return new FileInputStream(foundfile);
   662                                 return new FileInputStream(foundfile);
   663                             } catch (IOException e) {
   663                             } catch (IOException e) {
       
   664                             }
       
   665                         }
       
   666                     }
       
   667                     return null;
       
   668                 }
       
   669             });
       
   670 
       
   671             actions.add(new PrivilegedAction<InputStream>() {
       
   672                 public InputStream run() {
       
   673                     if (System.getProperties().getProperty("os.name")
       
   674                             .startsWith("Linux")) {
       
   675 
       
   676                         File[] systemSoundFontsDir = new File[] {
       
   677                             /* Arch, Fedora, Mageia */
       
   678                             new File("/usr/share/soundfonts/"),
       
   679                             new File("/usr/local/share/soundfonts/"),
       
   680                             /* Debian, Gentoo, OpenSUSE, Ubuntu */
       
   681                             new File("/usr/share/sounds/sf2/"),
       
   682                             new File("/usr/local/share/sounds/sf2/"),
       
   683                         };
       
   684 
       
   685                         /*
       
   686                          * Look for a default.sf2
       
   687                          */
       
   688                         for (File systemSoundFontDir : systemSoundFontsDir) {
       
   689                             if (systemSoundFontDir.exists()) {
       
   690                                 File defaultSoundFont = new File(systemSoundFontDir, "default.sf2");
       
   691                                 if (defaultSoundFont.exists()) {
       
   692                                     try {
       
   693                                         return new FileInputStream(defaultSoundFont);
       
   694                                     } catch (IOException e) {
       
   695                                         // continue with lookup
       
   696                                     }
       
   697                                 }
   664                             }
   698                             }
   665                         }
   699                         }
   666                     }
   700                     }
   667                     return null;
   701                     return null;
   668                 }
   702                 }