Program: 105427
Project: 105427
Buggy source:
@Override @ActionEvent(eventType=EventTypes.EVENT_TEMPLATE_CREATE,eventDescription="String_Node_Str") public GetUploadParamsResponse registerTemplateForPostUpload(GetUploadParamsForTemplateCmd cmd) throws ResourceAllocationException, MalformedURLException {
  TemplateAdapter adapter=getAdapter(HypervisorType.getType(cmd.getHypervisor()));
  TemplateProfile profile=adapter.prepare(cmd);
  List<TemplateOrVolumePostUploadCommand> payload=adapter.createTemplateForPostUpload(profile);
  if (CollectionUtils.isNotEmpty(payload)) {
    GetUploadParamsResponse response=new GetUploadParamsResponse();
    TemplateOrVolumePostUploadCommand firstCommand=payload.get(0);
    String url="String_Node_Str" + firstCommand.getEndPoint().getPublicAddr() + "String_Node_Str"+ firstCommand.getDataObject().getUuid();
    response.setPostURL(new URL(url));
    response.setId(UUID.fromString(firstCommand.getDataObject().getUuid()));
    DateTime currentDateTime=new DateTime(DateTimeZone.UTC);
    currentDateTime.plusHours(1);
    String expires=currentDateTime.toString();
    response.setTimeout(expires);
    String key=_configDao.getValue(Config.SSVMPSK.key());
    Gson gson=new GsonBuilder().setExclusionStrategies(new ExclusionStrategy(){
      @Override public boolean shouldSkipField(      FieldAttributes f){
        return f.getDeclaredType().getClass().isInstance(Logger.class);
      }
      @Override public boolean shouldSkipClass(      Class<?> clazz){
        return false;
      }
    }
).create();
    String jsonPayload=gson.toJson(payload);
    response.setMetadata(EncryptionUtil.encodeData(jsonPayload,key));
    response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires,key));
    return response;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override @ActionEvent(eventType=EventTypes.EVENT_TEMPLATE_CREATE,eventDescription="String_Node_Str") public GetUploadParamsResponse registerTemplateForPostUpload(GetUploadParamsForTemplateCmd cmd) throws ResourceAllocationException, MalformedURLException {
  TemplateAdapter adapter=getAdapter(HypervisorType.getType(cmd.getHypervisor()));
  TemplateProfile profile=adapter.prepare(cmd);
  List<TemplateOrVolumePostUploadCommand> payload=adapter.createTemplateForPostUpload(profile);
  if (CollectionUtils.isNotEmpty(payload)) {
    GetUploadParamsResponse response=new GetUploadParamsResponse();
    TemplateOrVolumePostUploadCommand firstCommand=payload.get(0);
    String url="String_Node_Str" + firstCommand.getEndPoint().getPublicAddr() + "String_Node_Str"+ firstCommand.getDataObject().getUuid();
    response.setPostURL(new URL(url));
    response.setId(UUID.fromString(firstCommand.getDataObject().getUuid()));
    DateTime currentDateTime=new DateTime(DateTimeZone.UTC);
    currentDateTime.plusHours(1);
    String expires=currentDateTime.toString();
    response.setTimeout(expires);
    String key=_configDao.getValue(Config.SSVMPSK.key());
    Gson gson=new GsonBuilder().registerTypeAdapter(TemplateOrVolumePostUploadCommand.class,new TemplateOrVolumePostUploadCommandTypeAdapter()).create();
    String jsonPayload=gson.toJson(payload);
    response.setMetadata(EncryptionUtil.encodeData(jsonPayload,key));
    response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires,key));
    return response;
  }
 else {
    return null;
  }
}