Program: 103195
Project: 103195
Buggy source:
/** 
 * Sets the system properties net.java.sip.communicator.SC_HOME_DIR_LOCATION and net.java.sip.communicator.SC_HOME_DIR_NAME (if they aren't already set) in accord with the OS conventions specified by the name of the OS. Please leave the access modifier as package (default) to allow launch- wrappers to call it.
 * @param osName the name of the OS according to which the SC_HOME_DIR_properties are to be set
 */
static void setScHomeDir(String osName){
  String location=System.getProperty(PNAME_SC_HOME_DIR_LOCATION);
  String name=System.getProperty(PNAME_SC_HOME_DIR_NAME);
  boolean isHomeDirnameForced=name != null;
  if ((location == null) || (name == null)) {
    String defaultLocation=System.getProperty("String_Node_Str");
    String defaultName="String_Node_Str";
    boolean chekLegacyDirNames=(name == null) || name.equals(overridableDirName);
    if (osName.startsWith("String_Node_Str")) {
      if (location == null)       location=System.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
      if (name == null)       name="String_Node_Str";
    }
 else     if (osName.startsWith("String_Node_Str")) {
      if (location == null)       location=System.getenv("String_Node_Str");
      if (name == null)       name="String_Node_Str";
    }
    if (location == null)     location=defaultLocation;
    if (name == null)     name=defaultName;
    if (!isHomeDirnameForced && (new File(location,name).isDirectory() == false) && new File(defaultLocation,defaultName).isDirectory()) {
      location=defaultLocation;
      name=defaultName;
    }
    if (chekLegacyDirNames && !new File(location,name).isDirectory()) {
      for (int i=0; i < legacyDirNames.length; i++) {
        if (new File(location,legacyDirNames[i]).isDirectory()) {
          name=legacyDirNames[i];
          break;
        }
        if (new File(defaultLocation,legacyDirNames[i]).isDirectory()) {
          name=legacyDirNames[i];
          location=defaultLocation;
          break;
        }
      }
    }
    System.setProperty(PNAME_SC_HOME_DIR_LOCATION,location);
    System.setProperty(PNAME_SC_HOME_DIR_NAME,name);
  }
  new File(location,name + File.separator + "String_Node_Str").mkdirs();
}

Fixed version (ground truth):
/** 
 * Sets the system properties net.java.sip.communicator.SC_HOME_DIR_LOCATION and net.java.sip.communicator.SC_HOME_DIR_NAME (if they aren't already set) in accord with the OS conventions specified by the name of the OS. Please leave the access modifier as package (default) to allow launch- wrappers to call it.
 * @param osName the name of the OS according to which the SC_HOME_DIR_properties are to be set
 */
static void setScHomeDir(String osName){
  String location=System.getProperty(PNAME_SC_HOME_DIR_LOCATION);
  String name=System.getProperty(PNAME_SC_HOME_DIR_NAME);
  boolean isHomeDirnameForced=name != null;
  if ((location == null) || (name == null)) {
    String defaultLocation=System.getProperty("String_Node_Str");
    String defaultName="String_Node_Str";
    boolean chekLegacyDirNames=(name == null) || name.equals(overridableDirName);
    if (osName.startsWith("String_Node_Str")) {
      if (location == null)       location=System.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
      if (name == null)       name="String_Node_Str";
    }
 else     if (osName.startsWith("String_Node_Str")) {
      if (location == null)       location=System.getenv("String_Node_Str");
      if (name == null)       name="String_Node_Str";
    }
    if (location == null)     location=defaultLocation;
    if (name == null)     name=defaultName;
    if (!isHomeDirnameForced && (new File(location,name).isDirectory() == false) && new File(defaultLocation,defaultName).isDirectory()) {
      location=defaultLocation;
      name=defaultName;
    }
    if (chekLegacyDirNames && !checkHomeFolderExist(location,name,osName)) {
      for (int i=0; i < legacyDirNames.length; i++) {
        if (checkHomeFolderExist(location,legacyDirNames[i],osName)) {
          name=legacyDirNames[i];
          break;
        }
        if (checkHomeFolderExist(defaultLocation,legacyDirNames[i],osName)) {
          name=legacyDirNames[i];
          location=defaultLocation;
          break;
        }
      }
    }
    System.setProperty(PNAME_SC_HOME_DIR_LOCATION,location);
    System.setProperty(PNAME_SC_HOME_DIR_NAME,name);
  }
  new File(location,name + File.separator + "String_Node_Str").mkdirs();
}