Program: 14118
Project: 14118
Buggy source:
ImageManifest(@Nonnull final String imageLocation,@Nullable final User user) throws EucalyptusCloudException {
  ManifestLocation mLoc=new ManifestLocation(imageLocation);
  this.imageLocation=mLoc.cleanLocation;
  String bucketName=mLoc.bucketName;
  String manifestKey=mLoc.manifestKey;
  final String manifestName=manifestKey.replaceAll("String_Node_Str","String_Node_Str");
  this.xpath=XPathFactory.newInstance().newXPath();
  this.xpathHelper=new Function<String,String>(){
    @Override public String apply(    String input){
      try {
        return (String)ImageManifest.this.xpath.evaluate(input,ImageManifest.this.inputSource,XPathConstants.STRING);
      }
 catch (      XPathExpressionException ex) {
        return null;
      }
    }
  }
;
  this.encryptedKey=this.xpathHelper.apply("String_Node_Str");
  this.encryptedIV=this.xpathHelper.apply("String_Node_Str");
  Predicate<ImageMetadata.Type> checkIdType=new Predicate<ImageMetadata.Type>(){
    @Override public boolean apply(    ImageMetadata.Type input){
      final String type=ImageManifest.this.xpathHelper.apply("String_Node_Str");
      if (type != null && type.equals(input.name())) {
        return true;
      }
      String value=ImageManifest.this.xpathHelper.apply(input.getManifestPath());
      return "String_Node_Str".equals(value) || "String_Node_Str".equals(value) || manifestName.startsWith(input.getNamePrefix());
    }
  }
;
  if (checkIdType.apply(ImageMetadata.Type.kernel) && user != null && !user.isSystemAdmin()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
 else   if (checkIdType.apply(ImageMetadata.Type.ramdisk) && user != null && !user.isSystemAdmin()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  this.manifest=ImageManifests.requestManifestData(bucketName,manifestKey);
  try {
    DocumentBuilder builder=XMLParser.getDocBuilder();
    this.inputSource=builder.parse(new ByteArrayInputStream(this.manifest.getBytes()));
  }
 catch (  Exception e) {
    throw new EucalyptusCloudException("String_Node_Str" + bucketName + "String_Node_Str"+ manifestKey,e);
  }
  String temp;
  this.name=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : manifestName.replace("String_Node_Str","String_Node_Str");
  this.checksum=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : "String_Node_Str";
  this.checksumType=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : "String_Node_Str";
  this.signature=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : null;
  this.userId=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : null;
  String typeInManifest=this.xpathHelper.apply(ImageMetadata.TYPE_MANIFEST_XPATH);
  this.size=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? Long.parseLong(temp) : -1l;
  this.bundledSize=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? Long.parseLong(temp) : -1l;
  String arch=this.xpathHelper.apply("String_Node_Str");
  this.architecture=ImageMetadata.Architecture.valueOf(((arch == null) ? "String_Node_Str" : arch));
  try {
    NodeList ancestorNodes=(NodeList)xpath.evaluate("String_Node_Str",inputSource,XPathConstants.NODESET);
    if (ancestorNodes != null) {
      for (int i=0; i < ancestorNodes.getLength(); i++) {
        for (        String ancestorId : ancestorNodes.item(i).getNodeValue().split("String_Node_Str")) {
          this.ancestors.add(ancestorId);
        }
      }
    }
  }
 catch (  XPathExpressionException ex) {
    LOG.error(ex,ex);
  }
  try {
    NodeList devMapList=(NodeList)this.xpath.evaluate("String_Node_Str",inputSource,XPathConstants.NODESET);
    for (int i=0; i < devMapList.getLength(); i++) {
      Node node=devMapList.item(i);
      NodeList children=node.getChildNodes();
      String virtualName=null;
      String device=null;
      for (int j=0; j < children.getLength(); j++) {
        Node childNode=children.item(j);
        String nodeType=childNode.getNodeName();
        if ("String_Node_Str".equals(nodeType) && childNode.getTextContent() != null) {
          virtualName=childNode.getTextContent();
        }
 else         if ("String_Node_Str".equals(nodeType) && childNode.getTextContent() != null) {
          device=childNode.getTextContent();
        }
      }
      if (virtualName != null && device != null) {
        if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.ami,virtualName,device));
          ;
        }
 else         if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.root,virtualName,device));
        }
 else         if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.swap,virtualName,device));
        }
 else         if (virtualName.startsWith("String_Node_Str")) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.ephemeral,virtualName,device));
        }
      }
    }
  }
 catch (  XPathExpressionException ex) {
    LOG.error(ex,ex);
  }
  if (checkIdType.apply(ImageMetadata.Type.kernel)) {
    this.imageType=ImageMetadata.Type.kernel;
    this.platform=ImageMetadata.Platform.linux;
    this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
    this.kernelId=null;
    this.ramdiskId=null;
  }
 else   if (checkIdType.apply(ImageMetadata.Type.ramdisk)) {
    this.imageType=ImageMetadata.Type.ramdisk;
    this.platform=ImageMetadata.Platform.linux;
    this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
    this.kernelId=null;
    this.ramdiskId=null;
  }
 else {
    String kId=this.xpathHelper.apply(ImageMetadata.Type.kernel.getManifestPath());
    String rId=this.xpathHelper.apply(ImageMetadata.Type.ramdisk.getManifestPath());
    this.imageType=ImageMetadata.Type.machine;
    if (!manifestName.startsWith(ImageMetadata.Platform.windows.toString()) && !(kId != null && ImageMetadata.Platform.windows.name().equals(kId))) {
      this.platform=ImageMetadata.Platform.linux;
      this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
      if (CloudMetadatas.isKernelImageIdentifier(kId)) {
        ImageManifests.checkPrivileges(this.kernelId);
        this.kernelId=kId;
      }
 else {
        this.kernelId=null;
      }
      if (CloudMetadatas.isRamdiskImageIdentifier(rId)) {
        ImageManifests.checkPrivileges(this.ramdiskId);
        this.ramdiskId=rId;
      }
 else {
        this.ramdiskId=null;
      }
    }
 else {
      this.platform=ImageMetadata.Platform.windows;
      this.virtualizationType=ImageMetadata.VirtualizationType.hvm;
      this.kernelId=null;
      this.ramdiskId=null;
    }
  }
}

Fixed version (ground truth):
ImageManifest(@Nonnull final String imageLocation,@Nullable final User user) throws EucalyptusCloudException {
  ManifestLocation mLoc=new ManifestLocation(imageLocation);
  this.imageLocation=mLoc.cleanLocation;
  String bucketName=mLoc.bucketName;
  String manifestKey=mLoc.manifestKey;
  final String manifestName=manifestKey.replaceAll("String_Node_Str","String_Node_Str");
  this.xpath=XPathFactory.newInstance().newXPath();
  this.xpathHelper=new Function<String,String>(){
    @Override public String apply(    String input){
      try {
        return (String)ImageManifest.this.xpath.evaluate(input,ImageManifest.this.inputSource,XPathConstants.STRING);
      }
 catch (      XPathExpressionException ex) {
        return null;
      }
    }
  }
;
  this.encryptedKey=this.xpathHelper.apply("String_Node_Str");
  this.encryptedIV=this.xpathHelper.apply("String_Node_Str");
  Predicate<ImageMetadata.Type> checkIdType=new Predicate<ImageMetadata.Type>(){
    @Override public boolean apply(    ImageMetadata.Type input){
      final String type=ImageManifest.this.xpathHelper.apply("String_Node_Str");
      if (type != null && type.equals(input.name())) {
        return true;
      }
      String value=ImageManifest.this.xpathHelper.apply(input.getManifestPath());
      return "String_Node_Str".equals(value) || "String_Node_Str".equals(value) || manifestName.startsWith(input.getNamePrefix());
    }
  }
;
  if (checkIdType.apply(ImageMetadata.Type.kernel) && user != null && !user.isSystemAdmin()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
 else   if (checkIdType.apply(ImageMetadata.Type.ramdisk) && user != null && !user.isSystemAdmin()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  this.manifest=ImageManifests.requestManifestData(bucketName,manifestKey);
  try {
    DocumentBuilder builder=XMLParser.getDocBuilder();
    this.inputSource=builder.parse(new ByteArrayInputStream(this.manifest.getBytes()));
  }
 catch (  Exception e) {
    throw new EucalyptusCloudException("String_Node_Str" + bucketName + "String_Node_Str"+ manifestKey,e);
  }
  String temp;
  this.name=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : manifestName.replace("String_Node_Str","String_Node_Str");
  this.checksum=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : "String_Node_Str";
  this.checksumType=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : "String_Node_Str";
  this.signature=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : null;
  this.userId=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? temp : null;
  String typeInManifest=this.xpathHelper.apply(ImageMetadata.TYPE_MANIFEST_XPATH);
  this.size=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? Long.parseLong(temp) : -1l;
  this.bundledSize=((temp=this.xpathHelper.apply("String_Node_Str")) != null) ? Long.parseLong(temp) : -1l;
  String arch=this.xpathHelper.apply("String_Node_Str");
  this.architecture=ImageMetadata.Architecture.valueOf(((arch == null) ? "String_Node_Str" : arch));
  try {
    NodeList ancestorNodes=(NodeList)xpath.evaluate("String_Node_Str",inputSource,XPathConstants.NODESET);
    if (ancestorNodes != null) {
      for (int i=0; i < ancestorNodes.getLength(); i++) {
        for (        String ancestorId : ancestorNodes.item(i).getNodeValue().split("String_Node_Str")) {
          this.ancestors.add(ancestorId);
        }
      }
    }
  }
 catch (  XPathExpressionException ex) {
    LOG.error(ex,ex);
  }
  try {
    NodeList devMapList=(NodeList)this.xpath.evaluate("String_Node_Str",inputSource,XPathConstants.NODESET);
    for (int i=0; i < devMapList.getLength(); i++) {
      Node node=devMapList.item(i);
      NodeList children=node.getChildNodes();
      String virtualName=null;
      String device=null;
      for (int j=0; j < children.getLength(); j++) {
        Node childNode=children.item(j);
        String nodeType=childNode.getNodeName();
        if ("String_Node_Str".equals(nodeType) && childNode.getTextContent() != null) {
          virtualName=childNode.getTextContent();
        }
 else         if ("String_Node_Str".equals(nodeType) && childNode.getTextContent() != null) {
          device=childNode.getTextContent();
        }
      }
      if (virtualName != null && device != null) {
        if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.ami,virtualName,device));
          ;
        }
 else         if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.root,virtualName,device));
        }
 else         if ("String_Node_Str".equals(virtualName)) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.swap,virtualName,device));
        }
 else         if (virtualName.startsWith("String_Node_Str")) {
          this.deviceMappings.add(new ManifestDeviceMapping(DeviceMappingType.ephemeral,virtualName,device));
        }
      }
    }
  }
 catch (  XPathExpressionException ex) {
    LOG.error(ex,ex);
  }
  if (checkIdType.apply(ImageMetadata.Type.kernel)) {
    this.imageType=ImageMetadata.Type.kernel;
    this.platform=ImageMetadata.Platform.linux;
    this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
    this.kernelId=null;
    this.ramdiskId=null;
  }
 else   if (checkIdType.apply(ImageMetadata.Type.ramdisk)) {
    this.imageType=ImageMetadata.Type.ramdisk;
    this.platform=ImageMetadata.Platform.linux;
    this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
    this.kernelId=null;
    this.ramdiskId=null;
  }
 else {
    String kId=this.xpathHelper.apply(ImageMetadata.Type.kernel.getManifestPath());
    String rId=this.xpathHelper.apply(ImageMetadata.Type.ramdisk.getManifestPath());
    this.imageType=ImageMetadata.Type.machine;
    if (!manifestName.startsWith(ImageMetadata.Platform.windows.toString()) && !(kId != null && ImageMetadata.Platform.windows.name().equals(kId))) {
      this.platform=ImageMetadata.Platform.linux;
      this.virtualizationType=ImageMetadata.VirtualizationType.paravirtualized;
      if (CloudMetadatas.isKernelImageIdentifier(kId)) {
        this.kernelId=kId;
      }
 else {
        this.kernelId=null;
      }
      if (CloudMetadatas.isRamdiskImageIdentifier(rId)) {
        this.ramdiskId=rId;
      }
 else {
        this.ramdiskId=null;
      }
    }
 else {
      this.platform=ImageMetadata.Platform.windows;
      this.virtualizationType=ImageMetadata.VirtualizationType.hvm;
      this.kernelId=null;
      this.ramdiskId=null;
    }
  }
}