Program: 75112
Project: 75112
Buggy source:
/** 
 * Get the specified property from the environment. An empty string is returned if the argument environment variable does not exist, though if certain properties are not defined, then we make various attempts to determine them and then set them. See the javadoc page for java.util.System.getProperties() for a list of system properties. <p>The following properties are handled specially <dl> <dt> "ptolemy.ptII.dir" <dd> vergil usually sets the ptolemy.ptII.dir property to the value of $PTII.  However, if we are running under Web Start, then this property might not be set, in which case we look for "ptolemy/kernel/util/NamedObj.class" and set the property accordingly. <dt> "ptolemy.ptII.dirAsURL" <dd> Return $PTII as a URL.  For example, if $PTII was c:\ptII, then return file:/c:/ptII/. <dt> "user.dir" <dd> Return the canonical path name to the current working directory. This is necessary because under JDK1.4.1 System.getProperty() returns <code><b>c</b>:/<i>foo</i></code> whereas most of the other methods that operate on path names return <code><b>C</b>:/<i>foo</i></code>. </dl>
 * @param propertyName The name of property.
 * @return A String containing the string value of the property.
 */
public static String getProperty(String propertyName){
  String property=null;
  try {
    property=System.getProperty(propertyName);
  }
 catch (  SecurityException ex) {
    if (!propertyName.equals("String_Node_Str")) {
      SecurityException security=new SecurityException("String_Node_Str" + propertyName + "String_Node_Str");
      security.initCause(ex);
      throw security;
    }
  }
  if (propertyName.equals("String_Node_Str")) {
    try {
      File userDirFile=new File(property);
      return userDirFile.getCanonicalPath();
    }
 catch (    IOException ex) {
      return property;
    }
  }
  if (property != null) {
    if (propertyName.equals("String_Node_Str") && (property.indexOf("String_Node_Str") != -1) && !_printedCygwinWarning) {
      _printedCygwinWarning=true;
      System.err.println("String_Node_Str" + property + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
    return property;
  }
  if (propertyName.equals("String_Node_Str")) {
    File ptIIAsFile=new File(getProperty("String_Node_Str"));
    try {
      URL ptIIAsURL=ptIIAsFile.toURL();
      return ptIIAsURL.toString();
    }
 catch (    java.net.MalformedURLException malformed) {
      throw new RuntimeException("String_Node_Str" + propertyName + "String_Node_Str"+ ptIIAsFile+ "String_Node_Str",malformed);
    }
  }
  if (propertyName.equals("String_Node_Str")) {
    String namedObjPath="String_Node_Str";
    String home=null;
    URL namedObjURL=Thread.currentThread().getContextClassLoader().getResource(namedObjPath);
    if (namedObjURL != null) {
      String namedObjFileName=namedObjURL.getFile().toString();
      if (namedObjFileName.startsWith("String_Node_Str")) {
        if (namedObjFileName.startsWith("String_Node_Str") || namedObjFileName.startsWith("String_Node_Str")) {
          namedObjFileName=namedObjFileName.substring(6);
        }
 else {
          namedObjFileName=namedObjFileName.substring(5);
        }
      }
      String abnormalHome=namedObjFileName.substring(0,namedObjFileName.length() - namedObjPath.length());
      home=(new File(abnormalHome)).toString();
      if (home.endsWith("String_Node_Str")) {
        home=home.substring(0,home.length() - 1);
      }
      String ptsupportJarName=File.separator + "String_Node_Str" + File.separator+ "String_Node_Str";
      if (home.endsWith(ptsupportJarName)) {
        home=home.substring(0,home.length() - ptsupportJarName.length());
      }
 else {
        ptsupportJarName="String_Node_Str";
        if (home.lastIndexOf(ptsupportJarName) != -1) {
          home.substring(0,home.lastIndexOf(ptsupportJarName));
        }
      }
    }
    if (home != null) {
      home=StringUtilities.substitute(home,"String_Node_Str","String_Node_Str");
    }
    if (home == null) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + namedObjPath + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
    try {
      System.setProperty("String_Node_Str",home);
    }
 catch (    SecurityException security) {
    }
    return home;
  }
  if (property == null) {
    return "String_Node_Str";
  }
  return property;
}

Fixed version (ground truth):
/** 
 * Get the specified property from the environment. An empty string is returned if the argument environment variable does not exist, though if certain properties are not defined, then we make various attempts to determine them and then set them. See the javadoc page for java.util.System.getProperties() for a list of system properties. <p>The following properties are handled specially <dl> <dt> "ptolemy.ptII.dir" <dd> vergil usually sets the ptolemy.ptII.dir property to the value of $PTII.  However, if we are running under Web Start, then this property might not be set, in which case we look for "ptolemy/kernel/util/NamedObj.class" and set the property accordingly. <dt> "ptolemy.ptII.dirAsURL" <dd> Return $PTII as a URL.  For example, if $PTII was c:\ptII, then return file:/c:/ptII/. <dt> "user.dir" <dd> Return the canonical path name to the current working directory. This is necessary because under JDK1.4.1 System.getProperty() returns <code><b>c</b>:/<i>foo</i></code> whereas most of the other methods that operate on path names return <code><b>C</b>:/<i>foo</i></code>. </dl>
 * @param propertyName The name of property.
 * @return A String containing the string value of the property.
 */
public static String getProperty(String propertyName){
  String property=null;
  try {
    property=System.getProperty(propertyName);
  }
 catch (  SecurityException ex) {
    if (!propertyName.equals("String_Node_Str")) {
      SecurityException security=new SecurityException("String_Node_Str" + propertyName + "String_Node_Str");
      security.initCause(ex);
      throw security;
    }
  }
  if (propertyName.equals("String_Node_Str")) {
    try {
      File userDirFile=new File(property);
      return userDirFile.getCanonicalPath();
    }
 catch (    IOException ex) {
      return property;
    }
  }
  if (property != null) {
    if (propertyName.equals("String_Node_Str") && (property.indexOf("String_Node_Str") != -1) && !_printedCygwinWarning) {
      _printedCygwinWarning=true;
      System.err.println("String_Node_Str" + property + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
    return property;
  }
  if (propertyName.equals("String_Node_Str")) {
    File ptIIAsFile=new File(getProperty("String_Node_Str"));
    try {
      URL ptIIAsURL=ptIIAsFile.toURL();
      return ptIIAsURL.toString();
    }
 catch (    java.net.MalformedURLException malformed) {
      throw new RuntimeException("String_Node_Str" + propertyName + "String_Node_Str"+ ptIIAsFile+ "String_Node_Str",malformed);
    }
  }
  if (propertyName.equals("String_Node_Str")) {
    String namedObjPath="String_Node_Str";
    String home=null;
    URL namedObjURL=Thread.currentThread().getContextClassLoader().getResource(namedObjPath);
    if (namedObjURL != null) {
      String namedObjFileName=namedObjURL.getFile();
      if (namedObjFileName.startsWith("String_Node_Str")) {
        if (namedObjFileName.startsWith("String_Node_Str") || namedObjFileName.startsWith("String_Node_Str")) {
          namedObjFileName=namedObjFileName.substring(6);
        }
 else {
          namedObjFileName=namedObjFileName.substring(5);
        }
      }
      String abnormalHome=namedObjFileName.substring(0,namedObjFileName.length() - namedObjPath.length());
      home=(new File(abnormalHome)).toString();
      if (home.endsWith("String_Node_Str")) {
        home=home.substring(0,home.length() - 1);
      }
      String ptsupportJarName=File.separator + "String_Node_Str" + File.separator+ "String_Node_Str";
      if (home.endsWith(ptsupportJarName)) {
        home=home.substring(0,home.length() - ptsupportJarName.length());
      }
 else {
        ptsupportJarName="String_Node_Str";
        if (home.lastIndexOf(ptsupportJarName) != -1) {
          home=home.substring(0,home.lastIndexOf(ptsupportJarName));
        }
      }
    }
    if (home != null) {
      home=StringUtilities.substitute(home,"String_Node_Str","String_Node_Str");
    }
    if (home == null) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + namedObjPath + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
    try {
      System.setProperty("String_Node_Str",home);
    }
 catch (    SecurityException security) {
    }
    return home;
  }
  if (property == null) {
    return "String_Node_Str";
  }
  return property;
}