Program: 15331
Project: 15331
Buggy source:
public RegisterImageResponseType register(RegisterImageType request) throws EucalyptusCloudException {
  final Context ctx=Contexts.lookup();
  User requestUser=Contexts.lookup().getUser();
  String action=PolicySpec.requestToAction(request);
  if (!ctx.hasAdministrativePrivileges()) {
    if (!Permissions.isAuthorized(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_IMAGE,"String_Node_Str",ctx.getAccount(),action,requestUser)) {
      throw new EucalyptusCloudException("String_Node_Str" + requestUser.getName());
    }
    if (!Permissions.canAllocate(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_IMAGE,"String_Node_Str",action,requestUser,1L)) {
      throw new EucalyptusCloudException("String_Node_Str" + requestUser.getName());
    }
  }
  ImageInfo imageInfo=null;
  final String rootDevName=(request.getRootDeviceName() != null) ? request.getRootDeviceName() : "String_Node_Str";
  final String eki=request.getKernelId();
  final String eri=request.getRamdiskId();
  if (request.getImageLocation() != null) {
    ImageManifest manifest=ImageManifests.lookup(request.getImageLocation());
    LOG.debug("String_Node_Str" + manifest);
    List<DeviceMapping> vbr=Lists.transform(request.getBlockDeviceMappings(),Images.deviceMappingGenerator(imageInfo));
    imageInfo=Images.createFromManifest(ctx.getUserFullName(),request.getName(),request.getDescription(),eki,eri,manifest);
    imageInfo.getDeviceMappings().addAll(vbr);
  }
 else   if (rootDevName != null && Iterables.any(request.getBlockDeviceMappings(),Images.findEbsRoot(rootDevName))) {
    imageInfo=Images.createFromDeviceMapping(ctx.getUserFullName(),rootDevName,request.getBlockDeviceMappings());
  }
 else {
    throw new EucalyptusCloudException("String_Node_Str" + "String_Node_Str" + request.getImageLocation() + "String_Node_Str"+ request.getBlockDeviceMappings());
  }
  RegisterImageResponseType reply=(RegisterImageResponseType)request.getReply();
  reply.setImageId(imageInfo.getDisplayName());
  return reply;
}

Fixed version (ground truth):
public RegisterImageResponseType register(RegisterImageType request) throws EucalyptusCloudException {
  final Context ctx=Contexts.lookup();
  User requestUser=Contexts.lookup().getUser();
  String action=PolicySpec.requestToAction(request);
  if (!ctx.hasAdministrativePrivileges()) {
    if (!Permissions.isAuthorized(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_IMAGE,"String_Node_Str",ctx.getAccount(),action,requestUser)) {
      throw new EucalyptusCloudException("String_Node_Str" + requestUser.getName());
    }
    if (!Permissions.canAllocate(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_IMAGE,"String_Node_Str",action,requestUser,1L)) {
      throw new EucalyptusCloudException("String_Node_Str" + requestUser.getName());
    }
  }
  ImageInfo imageInfo=null;
  final String rootDevName=(request.getRootDeviceName() != null) ? request.getRootDeviceName() : "String_Node_Str";
  final String eki=request.getKernelId();
  final String eri=request.getRamdiskId();
  if (request.getManifestLocation() != null) {
    ImageManifest manifest=ImageManifests.lookup(request.getManifestLocation());
    LOG.debug("String_Node_Str" + manifest);
    List<DeviceMapping> vbr=Lists.transform(request.getBlockDeviceMappings(),Images.deviceMappingGenerator(imageInfo));
    imageInfo=Images.createFromManifest(ctx.getUserFullName(),request.getName(),request.getDescription(),eki,eri,manifest);
    imageInfo.getDeviceMappings().addAll(vbr);
  }
 else   if (rootDevName != null && Iterables.any(request.getBlockDeviceMappings(),Images.findEbsRoot(rootDevName))) {
    imageInfo=Images.createFromDeviceMapping(ctx.getUserFullName(),request.getName(),request.getDescription(),eki,eri,rootDevName,request.getBlockDeviceMappings());
  }
 else {
    throw new EucalyptusCloudException("String_Node_Str" + "String_Node_Str" + request.getManifestLocation() + "String_Node_Str"+ request.getBlockDeviceMappings());
  }
  RegisterImageResponseType reply=(RegisterImageResponseType)request.getReply();
  reply.setImageId(imageInfo.getDisplayName());
  return reply;
}