src/demo/share/jpda/com/sun/tools/example/debug/gui/ContextManager.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 321     }
 322 
 323 
 324     /**
 325      * Add a -classpath argument to the arguments passed to the exec'ed
 326      * VM with the contents of CLASSPATH environment variable,
 327      * if -classpath was not already specified.
 328      *
 329      * @param javaArgs the arguments to the VM being exec'd that
 330      *                 potentially has a user specified -classpath argument.
 331      * @return a javaArgs whose -classpath option has been added
 332      */
 333 
 334     private String processClasspathDefaults(String javaArgs) {
 335         if (javaArgs.indexOf("-classpath ") == -1) {
 336             StringBuilder munged = new StringBuilder(javaArgs);
 337             SearchPath classpath = classManager.getClassPath();
 338             if (classpath.isEmpty()) {
 339                 String envcp = System.getProperty("env.class.path");
 340                 if ((envcp != null) && (envcp.length() > 0)) {
 341                     munged.append(" -classpath " + envcp);
 342                 }
 343             } else {
 344                 munged.append(" -classpath " + classpath.asString());
 345             }
 346             return munged.toString();
 347         } else {
 348             return javaArgs;
 349         }
 350     }
 351 
 352     private String appendPath(String path1, String path2) {
 353         if (path1 == null || path1.length() == 0) {
 354             return path2 == null ? "." : path2;
 355         } else if (path2 == null || path2.length() == 0) {
 356             return path1;
 357         } else {
 358             return path1  + File.pathSeparator + path2;
 359         }
 360     }
 361 
 362 }


 321     }
 322 
 323 
 324     /**
 325      * Add a -classpath argument to the arguments passed to the exec'ed
 326      * VM with the contents of CLASSPATH environment variable,
 327      * if -classpath was not already specified.
 328      *
 329      * @param javaArgs the arguments to the VM being exec'd that
 330      *                 potentially has a user specified -classpath argument.
 331      * @return a javaArgs whose -classpath option has been added
 332      */
 333 
 334     private String processClasspathDefaults(String javaArgs) {
 335         if (javaArgs.indexOf("-classpath ") == -1) {
 336             StringBuilder munged = new StringBuilder(javaArgs);
 337             SearchPath classpath = classManager.getClassPath();
 338             if (classpath.isEmpty()) {
 339                 String envcp = System.getProperty("env.class.path");
 340                 if ((envcp != null) && (envcp.length() > 0)) {
 341                     munged.append(" -classpath ").append(envcp);
 342                 }
 343             } else {
 344                 munged.append(" -classpath ").append(classpath.asString());
 345             }
 346             return munged.toString();
 347         } else {
 348             return javaArgs;
 349         }
 350     }
 351 










 352 }