Program: 147514
Project: 147514
Buggy source:
/** 
 * Allows to update a certain component.
 * @param componentId id of the component under a given project
 * @param component   updated component as a JSON object
 * @return Response with the updated component as a JSON object.
 */
@PUT @Path("String_Node_Str") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=HttpURLConnection.HTTP_OK,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_UNAUTHORIZED,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_NOT_FOUND,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_INTERNAL_ERROR,message="String_Node_Str")}) public HttpResponse updateComponent(@PathParam("String_Node_Str") int componentId,@ApiParam(value="String_Node_Str",required=true) String component){
  DALFacade dalFacade=null;
  try {
    String registratorErrors=bazaarService.notifyRegistrators(EnumSet.of(BazaarFunction.VALIDATION,BazaarFunction.USER_FIRST_LOGIN_HANDLING));
    if (registratorErrors != null) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,registratorErrors);
    }
    long userId=((UserAgent)getActiveAgent()).getId();
    Gson gson=new Gson();
    Component updatedComponent=gson.fromJson(component,Component.class);
    Vtor vtor=bazaarService.getValidators();
    vtor.validate(updatedComponent);
    if (vtor.hasViolations()) {
      ExceptionHandler.getInstance().handleViolations(vtor.getViolations());
    }
    dalFacade=bazaarService.createConnection();
    Integer internalUserId=dalFacade.getUserIdByLAS2PeerId(userId);
    boolean authorized=new AuthorizationManager().isAuthorized(internalUserId,PrivilegeEnum.Modify_COMPONENT,dalFacade);
    if (!authorized) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.AUTHORIZATION,Localization.getInstance().getResourceBundle().getString("String_Node_Str"));
    }
    if (updatedComponent.getId() != 0 && componentId != updatedComponent.getId()) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,"String_Node_Str");
    }
    updatedComponent=dalFacade.modifyComponent(updatedComponent);
    return new HttpResponse(gson.toJson(updatedComponent),HttpURLConnection.HTTP_OK);
  }
 catch (  BazaarException bex) {
    if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_UNAUTHORIZED);
    }
 else     if (bex.getErrorCode() == ErrorCode.NOT_FOUND) {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_NOT_FOUND);
    }
 else {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_INTERNAL_ERROR);
    }
  }
catch (  Exception ex) {
    BazaarException bazaarException=ExceptionHandler.getInstance().convert(ex,ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,"String_Node_Str");
    return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException),HttpURLConnection.HTTP_INTERNAL_ERROR);
  }
 finally {
    bazaarService.closeConnection(dalFacade);
  }
}

Fixed version (ground truth):
/** 
 * Allows to update a certain component.
 * @param componentId id of the component under a given project
 * @param component   updated component as a JSON object
 * @return Response with the updated component as a JSON object.
 */
@PUT @Path("String_Node_Str") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=HttpURLConnection.HTTP_OK,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_UNAUTHORIZED,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_NOT_FOUND,message="String_Node_Str"),@ApiResponse(code=HttpURLConnection.HTTP_INTERNAL_ERROR,message="String_Node_Str")}) public HttpResponse updateComponent(@PathParam("String_Node_Str") int componentId,@ApiParam(value="String_Node_Str",required=true) @ContentParam String component){
  DALFacade dalFacade=null;
  try {
    String registratorErrors=bazaarService.notifyRegistrators(EnumSet.of(BazaarFunction.VALIDATION,BazaarFunction.USER_FIRST_LOGIN_HANDLING));
    if (registratorErrors != null) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,registratorErrors);
    }
    long userId=((UserAgent)getActiveAgent()).getId();
    Gson gson=new Gson();
    Component updatedComponent=gson.fromJson(component,Component.class);
    Vtor vtor=bazaarService.getValidators();
    vtor.validate(updatedComponent);
    if (vtor.hasViolations()) {
      ExceptionHandler.getInstance().handleViolations(vtor.getViolations());
    }
    dalFacade=bazaarService.createConnection();
    Integer internalUserId=dalFacade.getUserIdByLAS2PeerId(userId);
    boolean authorized=new AuthorizationManager().isAuthorized(internalUserId,PrivilegeEnum.Modify_COMPONENT,dalFacade);
    if (!authorized) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.AUTHORIZATION,Localization.getInstance().getResourceBundle().getString("String_Node_Str"));
    }
    if (updatedComponent.getId() != 0 && componentId != updatedComponent.getId()) {
      ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,"String_Node_Str");
    }
    updatedComponent=dalFacade.modifyComponent(updatedComponent);
    return new HttpResponse(gson.toJson(updatedComponent),HttpURLConnection.HTTP_OK);
  }
 catch (  BazaarException bex) {
    if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_UNAUTHORIZED);
    }
 else     if (bex.getErrorCode() == ErrorCode.NOT_FOUND) {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_NOT_FOUND);
    }
 else {
      return new HttpResponse(ExceptionHandler.getInstance().toJSON(bex),HttpURLConnection.HTTP_INTERNAL_ERROR);
    }
  }
catch (  Exception ex) {
    BazaarException bazaarException=ExceptionHandler.getInstance().convert(ex,ExceptionLocation.BAZAARSERVICE,ErrorCode.UNKNOWN,"String_Node_Str");
    return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException),HttpURLConnection.HTTP_INTERNAL_ERROR);
  }
 finally {
    bazaarService.closeConnection(dalFacade);
  }
}