Program: 10764
Project: 10764
Buggy source:
/** 
 * Writes the app's current deployment info into a manifest file in the app's related workspace project. If the workspace project is not accessible, false is returned. If the manifest file does not exist in the app's workspace project, one will be created. If manifest file failed to create, exception is thrown. Returns true if the manifest file was successfully written. If so, the project is also refreshed.
 * @return true if deployment info for the cloud module was written tomanifest file. False if there was no content to write to the manifest file.
 * @throws CoreException if error occurred while writing to a Manifest file.
 */
public boolean write(IProgressMonitor monitor) throws CoreException {
  ApplicationDeploymentInfo deploymentInfo=appModule.getDeploymentInfo();
  if (deploymentInfo == null) {
    return false;
  }
  Map<Object,Object> deploymentInfoYaml=parseManifestFromFile();
  if (deploymentInfoYaml == null) {
    deploymentInfoYaml=new HashMap<Object,Object>();
  }
  Map<Object,Object> applicationProperties=getContainingPropertiesMap(deploymentInfoYaml,APPLICATIONS_PROP);
  if (applicationProperties == null) {
    applicationProperties=new HashMap<Object,Object>();
    deploymentInfoYaml.put(APPLICATIONS_PROP,applicationProperties);
  }
  String appName=deploymentInfo.getDeploymentName();
  if (appName != null) {
    applicationProperties.put(NAME_PROP,appName);
  }
  int memory=deploymentInfo.getMemory();
  if (memory > 0) {
    applicationProperties.put(MEMORY_PROP,memory + 'M');
  }
  List<String> servicesToBind=deploymentInfo.getServices();
  if (servicesToBind != null && !servicesToBind.isEmpty()) {
    Map<Object,Object> services=getContainingPropertiesMap(applicationProperties,SERVICES_PROP);
    if (services == null) {
      services=new HashMap<Object,Object>();
      applicationProperties.put(SERVICES_PROP,services);
    }
    for (    String service : servicesToBind) {
      services.put(service,null);
    }
  }
  if (deploymentInfoYaml.isEmpty()) {
    return false;
  }
  Yaml yaml=new Yaml();
  String manifestValue=yaml.dump(deploymentInfoYaml);
  if (manifestValue == null) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + appModule.getDeployedApplicationName() + "String_Node_Str"+ deploymentInfoYaml);
  }
  OutputStream outStream=null;
  try {
    outStream=getOutStream();
    if (outStream == null) {
      throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName());
    }
    outStream.write(manifestValue.getBytes());
    outStream.flush();
    IProject project=CloudUtil.getProject(appModule);
    if (project != null) {
      project.refreshLocal(IResource.DEPTH_INFINITE,monitor);
    }
    return true;
  }
 catch (  IOException io) {
    throw CloudErrorUtil.toCoreException(io);
  }
 finally {
    if (outStream != null) {
      try {
        outStream.close();
      }
 catch (      IOException io) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the app's current deployment info into a manifest file in the app's related workspace project. If the workspace project is not accessible, false is returned. If the manifest file does not exist in the app's workspace project, one will be created. If manifest file failed to create, exception is thrown. Returns true if the manifest file was successfully written. If so, the project is also refreshed.
 * @return true if deployment info for the cloud module was written tomanifest file. False if there was no content to write to the manifest file.
 * @throws CoreException if error occurred while writing to a Manifest file.
 */
public boolean write(IProgressMonitor monitor) throws CoreException {
  ApplicationDeploymentInfo deploymentInfo=appModule.getDeploymentInfo();
  if (deploymentInfo == null) {
    return false;
  }
  Map<Object,Object> deploymentInfoYaml=parseManifestFromFile();
  if (deploymentInfoYaml == null) {
    deploymentInfoYaml=new HashMap<Object,Object>();
  }
  Map<Object,Object> applicationProperties=getContainingPropertiesMap(deploymentInfoYaml,APPLICATIONS_PROP);
  if (applicationProperties == null) {
    applicationProperties=new HashMap<Object,Object>();
    deploymentInfoYaml.put(APPLICATIONS_PROP,applicationProperties);
  }
  String appName=deploymentInfo.getDeploymentName();
  if (appName != null) {
    applicationProperties.put(NAME_PROP,appName);
  }
  int memory=deploymentInfo.getMemory();
  if (memory > 0) {
    applicationProperties.put(MEMORY_PROP,memory);
  }
  Map<Object,Object> services=new HashMap<Object,Object>();
  applicationProperties.put(SERVICES_PROP,services);
  List<String> servicesToBind=deploymentInfo.getServices();
  if (servicesToBind != null) {
    for (    String service : servicesToBind) {
      services.put(service,null);
    }
  }
  if (deploymentInfoYaml.isEmpty()) {
    return false;
  }
  Yaml yaml=new Yaml();
  String manifestValue=yaml.dump(deploymentInfoYaml);
  if (manifestValue == null) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + appModule.getDeployedApplicationName() + "String_Node_Str"+ deploymentInfoYaml);
  }
  OutputStream outStream=null;
  try {
    outStream=getOutStream();
    if (outStream == null) {
      throw CloudErrorUtil.toCoreException("String_Node_Str" + relativePath + "String_Node_Str"+ appModule.getDeployedApplicationName());
    }
    outStream.write(manifestValue.getBytes());
    outStream.flush();
    IProject project=CloudUtil.getProject(appModule);
    if (project != null) {
      project.refreshLocal(IResource.DEPTH_INFINITE,monitor);
    }
    return true;
  }
 catch (  IOException io) {
    throw CloudErrorUtil.toCoreException(io);
  }
 finally {
    if (outStream != null) {
      try {
        outStream.close();
      }
 catch (      IOException io) {
      }
    }
  }
}