Program: 49217
Project: 49217
Buggy source:
/** 
 * Updates a pool for an Owner. assumes this is a normal pool, and errors out otherwise cause we cannot create master pools from bonus pools TODO: while this method replaces the now deprecated updateSubsciption, it still uses it underneath. We need to re-implement the wheel like we did in createPool
 * @httpcode 404
 * @httpcode 200
 */
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") @ApiOperation(notes="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",value="String_Node_Str") @ApiResponses({@ApiResponse(code=404,message="String_Node_Str")}) public void updatePool(@PathParam("String_Node_Str") @Verify(Owner.class) String ownerKey,@ApiParam(name="String_Node_Str",required=true) Pool newPool){
  Pool currentPool=this.poolManager.find(newPool.getId());
  if (currentPool == null) {
    throw new NotFoundException(i18n.tr("String_Node_Str",newPool.getId()));
  }
  if (currentPool.getType() != PoolType.NORMAL || newPool.getType() != PoolType.NORMAL) {
    throw new BadRequestException(i18n.tr("String_Node_Str"));
  }
  if (currentPool.isCreatedByShare() || newPool.isCreatedByShare()) {
    throw new BadRequestException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  newPool.setProduct(currentPool.getProduct());
  newPool.setDerivedProduct(currentPool.getDerivedProduct());
  newPool=resolverUtil.resolvePool(newPool);
  this.poolManager.updateMasterPool(newPool);
}

Fixed version (ground truth):
/** 
 * Updates a pool for an Owner. assumes this is a normal pool, and errors out otherwise cause we cannot create master pools from bonus pools TODO: while this method replaces the now deprecated updateSubsciption, it still uses it underneath. We need to re-implement the wheel like we did in createPool
 * @httpcode 404
 * @httpcode 200
 */
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") @ApiOperation(notes="String_Node_Str" + "String_Node_Str",value="String_Node_Str") @ApiResponses({@ApiResponse(code=404,message="String_Node_Str")}) public void updatePool(@PathParam("String_Node_Str") @Verify(Owner.class) String ownerKey,@ApiParam(name="String_Node_Str",required=true) Pool newPool){
  Pool currentPool=this.poolManager.find(newPool.getId());
  if (currentPool == null) {
    throw new NotFoundException(i18n.tr("String_Node_Str",newPool.getId()));
  }
  if (currentPool.getOwner() == null || !ownerKey.equals(currentPool.getOwner().getKey())) {
    throw new NotFoundException(i18n.tr("String_Node_Str",newPool.getId()));
  }
  newPool.setOwner(currentPool.getOwner());
  if (currentPool.getType() != PoolType.NORMAL || newPool.getType() != PoolType.NORMAL) {
    throw new BadRequestException(i18n.tr("String_Node_Str"));
  }
  if (currentPool.isCreatedByShare() || newPool.isCreatedByShare()) {
    throw new BadRequestException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  newPool.setProduct(currentPool.getProduct());
  newPool.setDerivedProduct(currentPool.getDerivedProduct());
  newPool.setActiveSubscription(currentPool.getActiveSubscription());
  newPool.setCreatedByShare(currentPool.isCreatedByShare());
  newPool.setHasSharedAncestor(currentPool.hasSharedAncestor());
  newPool.setSourceEntitlement(currentPool.getSourceEntitlement());
  newPool.setSourceStack(currentPool.getSourceStack());
  newPool.setSourceSubscription(currentPool.getSourceSubscription());
  newPool.setEntitlements(currentPool.getEntitlements());
  newPool.setRestrictedToUsername(currentPool.getRestrictedToUsername());
  newPool.setContractNumber(currentPool.getContractNumber());
  newPool.setAccountNumber(currentPool.getAccountNumber());
  newPool.setOrderNumber(currentPool.getOrderNumber());
  newPool.setConsumed(currentPool.getConsumed());
  newPool.setExported(currentPool.getExported());
  newPool.setShared(currentPool.getShared());
  newPool.setUpstreamPoolId(currentPool.getUpstreamPoolId());
  newPool.setUpstreamEntitlementId(currentPool.getUpstreamEntitlementId());
  newPool.setUpstreamConsumerId(currentPool.getUpstreamConsumerId());
  newPool.setCertificate(currentPool.getCertificate());
  newPool.setCdn(currentPool.getCdn());
  if (newPool.getQuantity() == null) {
    newPool.setQuantity(currentPool.getQuantity());
  }
  if (newPool.getStartDate() == null) {
    newPool.setStartDate(currentPool.getStartDate());
  }
  if (newPool.getEndDate() == null) {
    newPool.setEndDate(currentPool.getEndDate());
  }
  if (newPool.getAttributes() == null) {
    newPool.setAttributes(currentPool.getAttributes());
  }
  if (newPool.getBranding() == null) {
    newPool.setBranding(currentPool.getBranding());
  }
  newPool=resolverUtil.resolvePool(newPool);
  this.poolManager.updateMasterPool(newPool);
}