Program: 15128
Project: 15128
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(),request.getName(),request.getDescription(),eki,eri,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.getImageLocation() != null) {
    ImageManifest manifest=ImageManifests.lookup(request.getImageLocation());
    LOG.debug("String_Node_Str" + manifest);
    List<DeviceMapping> vbr=Lists.transform(request.getBlockDeviceMappings(),Images.deviceMappingGenerator(imageInfo));
    Image.Architecture arch=(request.getArchitecture() == null ? null : Image.Architecture.valueOf(request.getArchitecture()));
    imageInfo=Images.createFromManifest(ctx.getUserFullName(),request.getName(),request.getDescription(),arch,null,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.getImageLocation() + "String_Node_Str"+ request.getBlockDeviceMappings());
  }
  RegisterImageResponseType reply=(RegisterImageResponseType)request.getReply();
  reply.setImageId(imageInfo.getDisplayName());
  return reply;
}