< prev index next >

src/java.base/share/classes/sun/net/www/MimeLauncher.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


 145             while ((inx = c.indexOf("%s")) >= 0) {
 146                 c = c.substring(0, inx) + ofn + c.substring(inx + 2);
 147                 substituted = true;
 148             }
 149             if (!substituted)
 150                 c = c + " <" + ofn;
 151 
 152             // System.out.println("Execing " +c);
 153 
 154             Runtime.getRuntime().exec(c);
 155         } catch(IOException e) {
 156         }
 157     }
 158 
 159     /* This method determines the path for the launcher application
 160        and sets the execPath instance variable.  It uses the exec.path
 161        property to obtain a list of paths that is in turn used to
 162        location the application.  If a valid path is not found, it
 163        returns false else true.  */
 164     private boolean findExecutablePath(String str) {
 165         if (str == null || str.length() == 0) {
 166             return false;
 167         }
 168 
 169         String command;
 170         int index = str.indexOf(' ');
 171         if (index != -1) {
 172             command = str.substring(0, index);
 173         }
 174         else {
 175             command = str;
 176         }
 177 
 178         File f = new File(command);
 179         if (f.isFile()) {
 180             // Already executable as it is
 181             execPath = str;
 182             return true;
 183         }
 184 
 185         String execPathList;


 145             while ((inx = c.indexOf("%s")) >= 0) {
 146                 c = c.substring(0, inx) + ofn + c.substring(inx + 2);
 147                 substituted = true;
 148             }
 149             if (!substituted)
 150                 c = c + " <" + ofn;
 151 
 152             // System.out.println("Execing " +c);
 153 
 154             Runtime.getRuntime().exec(c);
 155         } catch(IOException e) {
 156         }
 157     }
 158 
 159     /* This method determines the path for the launcher application
 160        and sets the execPath instance variable.  It uses the exec.path
 161        property to obtain a list of paths that is in turn used to
 162        location the application.  If a valid path is not found, it
 163        returns false else true.  */
 164     private boolean findExecutablePath(String str) {
 165         if (str == null || str.isEmpty()) {
 166             return false;
 167         }
 168 
 169         String command;
 170         int index = str.indexOf(' ');
 171         if (index != -1) {
 172             command = str.substring(0, index);
 173         }
 174         else {
 175             command = str;
 176         }
 177 
 178         File f = new File(command);
 179         if (f.isFile()) {
 180             // Already executable as it is
 181             execPath = str;
 182             return true;
 183         }
 184 
 185         String execPathList;
< prev index next >