Program: 13220
Project: 13220
Buggy source:
/** 
 * Updates the specified object in the object set. <p/> This implementation requires MVCC and hence enforces that clients state what revision they expect to be updating <p/> If successful, this method updates metadata properties within the passed object, including: a new   {@code _rev} value for the revised object's version
 * @param resourceName the identifier of the resource to be updated
 * @param rev    the version of the object to update; or {@code null} if not provided.
 * @param obj    the contents of the object to put in the object set.
 * @throws ConflictException           if version is required but is {@code null}.
 * @throws ForbiddenException          if access to the object is forbidden.
 * @throws NotFoundException           if the specified object could not be found.
 * @throws PreconditionFailedException if version did not match the existing object in the set.
 * @throws BadRequestException         if the passed identifier is invalid
 */
public void update(ResourceName resourceName,String rev,Map<String,Object> obj) throws ResourceException {
  logger.debug("String_Node_Str",resourceName.toString(),rev);
  if (resourceName.isEmpty()) {
    throw new BadRequestException("String_Node_Str");
  }
 else   if (resourceName.size() > 2) {
    throw new BadRequestException("String_Node_Str");
  }
  try {
    ParsedId parsedId=new ParsedId(resourceName);
    Configuration config=findExistingConfiguration(parsedId);
    Dictionary existingConfig=(config == null ? null : config.getProperties());
    if (existingConfig == null) {
      throw new NotFoundException("String_Node_Str" + resourceName.toString() + "String_Node_Str");
    }
    existingConfig=configCrypto.encrypt(parsedId.getPidOrFactoryPid(),parsedId.instanceAlias,existingConfig,new JsonValue(obj));
    config.update(existingConfig);
    logger.debug("String_Node_Str",resourceName.toString(),existingConfig);
  }
 catch (  ResourceException ex) {
    throw ex;
  }
catch (  Exception ex) {
    logger.warn("String_Node_Str",resourceName.toString(),ex);
    throw new InternalServerErrorException("String_Node_Str" + resourceName.toString() + "String_Node_Str"+ ex.getMessage(),ex);
  }
}

Fixed version (ground truth):
/** 
 * Updates the specified object in the object set. <p/> This implementation requires MVCC and hence enforces that clients state what revision they expect to be updating <p/> If successful, this method updates metadata properties within the passed object, including: a new   {@code _rev} value for the revised object's version
 * @param resourceName the identifier of the resource to be updated
 * @param rev    the version of the object to update; or {@code null} if not provided.
 * @param obj    the contents of the object to put in the object set.
 * @throws ConflictException           if version is required but is {@code null}.
 * @throws ForbiddenException          if access to the object is forbidden.
 * @throws NotFoundException           if the specified object could not be found.
 * @throws PreconditionFailedException if version did not match the existing object in the set.
 * @throws BadRequestException         if the passed identifier is invalid
 */
public void update(ResourceName resourceName,String rev,Map<String,Object> obj) throws ResourceException {
  logger.debug("String_Node_Str",resourceName.toString(),rev);
  if (resourceName.isEmpty()) {
    throw new BadRequestException("String_Node_Str");
  }
 else   if (resourceName.size() > 2) {
    throw new BadRequestException("String_Node_Str");
  }
  ParsedId parsedId=new ParsedId(resourceName);
  try {
    Configuration config=findExistingConfiguration(parsedId);
    Dictionary existingConfig=(config == null ? null : config.getProperties());
    if (existingConfig == null) {
      throw new NotFoundException("String_Node_Str" + resourceName.toString() + "String_Node_Str");
    }
    existingConfig=configCrypto.encrypt(parsedId.getPidOrFactoryPid(),parsedId.instanceAlias,existingConfig,new JsonValue(obj));
    config.update(existingConfig);
    logger.debug("String_Node_Str",resourceName.toString(),existingConfig);
  }
 catch (  ResourceException ex) {
    throw ex;
  }
catch (  JsonValueException ex) {
    logger.warn("String_Node_Str" + ex.getMessage(),resourceName.toString(),ex);
    throw new BadRequestException("String_Node_Str" + resourceName.toString() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  WaitForMetaData ex) {
    logger.info("String_Node_Str",parsedId.toString(),ex);
    throw new InternalServerErrorException("String_Node_Str" + parsedId.toString() + "String_Node_Str",ex);
  }
catch (  Exception ex) {
    logger.warn("String_Node_Str",resourceName.toString(),ex);
    throw new InternalServerErrorException("String_Node_Str" + resourceName.toString() + "String_Node_Str"+ ex.getMessage(),ex);
  }
}