Program: 10765
Project: 10765
Buggy source:
/** 
 * @return Deployment copy if a manifest file was successfully loaded intoan app's deployment info working copy. Note that the copy is NOT saved. Null if there is no content to load into the app's deployment info working copy.
 * @throws CoreException if error occurred while loading an existingmanifest file.
 */
public DeploymentInfoWorkingCopy load() throws CoreException {
  DeploymentInfoWorkingCopy workingCopy=appModule.getDeploymentInfoWorkingCopy();
  Map<Object,Object> results=parseManifestFromFile();
  if (results == null) {
    return null;
  }
  Object applicationsObj=results.get(APPLICATIONS_PROP);
  if (!(applicationsObj instanceof List<?>)) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str");
  }
  List<?> applicationsList=(List<?>)applicationsObj;
  if (applicationsList.isEmpty()) {
    return null;
  }
  Object mapObj=applicationsList.get(0);
  if (!(mapObj instanceof Map<?,?>)) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str");
  }
  Map<?,?> applications=(Map<?,?>)mapObj;
  String appName=getStringValue(applications,NAME_PROP);
  if (appName != null) {
    workingCopy.setDeploymentName(appName);
  }
  Integer memoryVal=getIntegerValue(applications,MEMORY_PROP);
  if (memoryVal == null) {
    String memoryStringVal=getStringValue(applications,MEMORY_PROP);
    if (memoryStringVal != null && memoryStringVal.length() > 0) {
      char memoryIndicator[]={'M','G','m','g'};
      int gIndex=-1;
      for (      char indicator : memoryIndicator) {
        gIndex=memoryStringVal.indexOf(indicator);
        if (gIndex >= 0) {
          break;
        }
      }
      if (gIndex > 0) {
        memoryStringVal=memoryStringVal.substring(0,gIndex);
      }
 else       if (gIndex == 0) {
        CloudFoundryPlugin.logError("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName()+ "String_Node_Str"+ memoryStringVal);
      }
      try {
        memoryVal=Integer.valueOf(memoryStringVal);
      }
 catch (      NumberFormatException e) {
        CloudFoundryPlugin.logError("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName()+ "String_Node_Str"+ e.getMessage());
      }
    }
  }
  if (memoryVal != null) {
    int actualMemory=-1;
switch (memoryVal.intValue()) {
case 1:
      actualMemory=1024;
    break;
case 2:
  actualMemory=2048;
break;
default :
actualMemory=memoryVal.intValue();
break;
}
if (actualMemory > 0) {
workingCopy.setMemory(actualMemory);
}
}
String subdomain=getStringValue(applications,SUB_DOMAIN_PROP);
String domain=getStringValue(applications,DOMAIN_PROP);
if (subdomain != null || domain != null) {
String url=null;
if (subdomain == null) {
subdomain=appName;
}
 else {
CloudApplicationUrlLookup lookup=CloudApplicationUrlLookup.getCurrentLookup(cloudServer);
CloudApplicationURL cloudURL=lookup.getDefaultApplicationURL(subdomain);
if (cloudURL != null) {
url=cloudURL.getUrl();
}
}
if (url == null) {
url=subdomain + '.' + domain;
}
if (url != null) {
List<String> urls=Arrays.asList(url);
workingCopy.setUris(urls);
}
}
String buildpackurl=getStringValue(applications,BUILDPACK_PROP);
if (buildpackurl != null) {
Staging staging=new Staging(null,buildpackurl);
workingCopy.setStaging(staging);
}
parseServices(workingCopy,applications);
return workingCopy;
}

Fixed version (ground truth):
/** 
 * @return Deployment copy if a manifest file was successfully loaded intoan app's deployment info working copy. Note that the copy is NOT saved. Null if there is no content to load into the app's deployment info working copy.
 * @throws CoreException if error occurred while loading an existingmanifest file.
 */
public DeploymentInfoWorkingCopy load() throws CoreException {
  DeploymentInfoWorkingCopy workingCopy=appModule.getDeploymentInfoWorkingCopy();
  Map<Object,Object> results=parseManifestFromFile();
  if (results == null) {
    return null;
  }
  Object applicationsObj=results.get(APPLICATIONS_PROP);
  if (!(applicationsObj instanceof List<?>)) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str");
  }
  List<?> applicationsList=(List<?>)applicationsObj;
  if (applicationsList.isEmpty()) {
    return null;
  }
  if (applicationsList.size() > 1) {
    File file=getFile();
    String fileName=null;
    if (file != null) {
      fileName=file.getAbsolutePath();
    }
    CloudFoundryPlugin.logWarning("String_Node_Str" + (fileName != null ? fileName : "String_Node_Str") + "String_Node_Str"+ appModule.getDeployedApplicationName());
  }
  Object mapObj=applicationsList.get(0);
  if (!(mapObj instanceof Map<?,?>)) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str");
  }
  Map<?,?> applications=(Map<?,?>)mapObj;
  String appName=getStringValue(applications,NAME_PROP);
  if (appName != null) {
    workingCopy.setDeploymentName(appName);
  }
  Integer memoryVal=getIntegerValue(applications,MEMORY_PROP);
  if (memoryVal == null) {
    String memoryStringVal=getStringValue(applications,MEMORY_PROP);
    if (memoryStringVal != null && memoryStringVal.length() > 0) {
      char memoryIndicator[]={'M','G','m','g'};
      int gIndex=-1;
      for (      char indicator : memoryIndicator) {
        gIndex=memoryStringVal.indexOf(indicator);
        if (gIndex >= 0) {
          break;
        }
      }
      if (gIndex > 0) {
        memoryStringVal=memoryStringVal.substring(0,gIndex);
      }
 else       if (gIndex == 0) {
        CloudFoundryPlugin.logError("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName()+ "String_Node_Str"+ memoryStringVal);
      }
      try {
        memoryVal=Integer.valueOf(memoryStringVal);
      }
 catch (      NumberFormatException e) {
        CloudFoundryPlugin.logError("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName()+ "String_Node_Str"+ e.getMessage());
      }
    }
  }
  if (memoryVal != null) {
    int actualMemory=-1;
switch (memoryVal.intValue()) {
case 1:
      actualMemory=1024;
    break;
case 2:
  actualMemory=2048;
break;
default :
actualMemory=memoryVal.intValue();
break;
}
if (actualMemory > 0) {
workingCopy.setMemory(actualMemory);
}
}
String subdomain=getStringValue(applications,SUB_DOMAIN_PROP);
String domain=getStringValue(applications,DOMAIN_PROP);
if (subdomain != null || domain != null) {
String url=null;
if (subdomain == null) {
subdomain=appName;
}
 else {
CloudApplicationUrlLookup lookup=CloudApplicationUrlLookup.getCurrentLookup(cloudServer);
CloudApplicationURL cloudURL=lookup.getDefaultApplicationURL(subdomain);
if (cloudURL != null) {
url=cloudURL.getUrl();
}
}
if (url == null) {
url=subdomain + '.' + domain;
}
if (url != null) {
List<String> urls=Arrays.asList(url);
workingCopy.setUris(urls);
}
}
String buildpackurl=getStringValue(applications,BUILDPACK_PROP);
if (buildpackurl != null) {
Staging staging=new Staging(null,buildpackurl);
workingCopy.setStaging(staging);
}
parseServices(workingCopy,applications);
return workingCopy;
}