Program: 79848
Project: 79848
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void updateInstance(final ServerContext context,final String resourceId,final UpdateRequest request,final ResultHandler<Resource> handler){
  Token admin=new Token();
  admin.setId(getCookieFromServerContext(context));
  final JsonValue jVal=request.getNewContent();
  final String rev=request.getRevision();
  IdentityDetails dtls, newDtls;
  IdentityServicesImpl idsvc=new IdentityServicesImpl();
  ;
  Resource resource;
  try {
    dtls=idsvc.read(resourceId,idSvcsAttrList,admin);
    newDtls=jsonValueToIdentityDetails(jVal);
    newDtls.setName(resourceId);
    String userpass=jVal.get("String_Node_Str").asString();
    if (userpass != null && !userpass.isEmpty()) {
      if (checkValidPassword(resourceId,userpass.toCharArray(),realm) || isAdmin(context)) {
      }
 else {
        String strPass=getPasswordFromHeader(context);
        if (strPass != null && !strPass.isEmpty() && checkValidPassword(resourceId,strPass.toCharArray(),realm)) {
        }
 else {
          throw new ForbiddenException("String_Node_Str",null);
        }
      }
    }
    UpdateResponse message=idsvc.update(newDtls,admin);
    IdentityDetails checkIdent=idsvc.read(dtls.getName(),idSvcsAttrList,admin);
    resource=new Resource(resourceId,"String_Node_Str",identityDetailsToJsonValue(checkIdent));
    handler.handleResult(resource);
  }
 catch (  final ObjectNotFound onf) {
    RestDispatcher.debug.error("String_Node_Str" + onf);
    handler.handleError(new NotFoundException("String_Node_Str" + resourceId + "String_Node_Str",onf));
  }
catch (  final NeedMoreCredentials needMoreCredentials) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ needMoreCredentials);
    handler.handleError(new ForbiddenException("String_Node_Str",needMoreCredentials));
  }
catch (  final TokenExpired tokenExpired) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ tokenExpired);
    handler.handleError(new PermanentException(401,"String_Node_Str",null));
  }
catch (  final AccessDenied accessDenied) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ accessDenied);
    handler.handleError(new ForbiddenException(accessDenied.getMessage(),accessDenied));
  }
catch (  final GeneralFailure generalFailure) {
    RestDispatcher.debug.error("String_Node_Str" + generalFailure);
    handler.handleError(new BadRequestException(generalFailure.getMessage(),generalFailure));
  }
catch (  ForbiddenException fe) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ fe);
    handler.handleError(fe);
  }
catch (  final Exception exception) {
    RestDispatcher.debug.error("String_Node_Str" + exception);
    handler.handleError(new NotFoundException(exception.getMessage(),exception));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void updateInstance(final ServerContext context,final String resourceId,final UpdateRequest request,final ResultHandler<Resource> handler){
  Token admin=new Token();
  admin.setId(getCookieFromServerContext(context));
  final JsonValue jVal=request.getNewContent();
  final String rev=request.getRevision();
  IdentityDetails dtls, newDtls;
  IdentityServicesImpl idsvc=new IdentityServicesImpl();
  ;
  Resource resource;
  try {
    dtls=idsvc.read(resourceId,idSvcsAttrList,admin);
    newDtls=jsonValueToIdentityDetails(jVal);
    newDtls.setName(resourceId);
    String userpass=jVal.get("String_Node_Str").asString();
    if (userpass != null && !userpass.isEmpty()) {
      if (checkValidPassword(resourceId,userpass.toCharArray(),realm) || isAdmin(context)) {
      }
 else {
        String strPass=getPasswordFromHeader(context);
        if (strPass != null && !strPass.isEmpty() && checkValidPassword(resourceId,strPass.toCharArray(),realm)) {
        }
 else {
          throw new BadRequestException("String_Node_Str");
        }
      }
    }
    UpdateResponse message=idsvc.update(newDtls,admin);
    IdentityDetails checkIdent=idsvc.read(dtls.getName(),idSvcsAttrList,admin);
    resource=new Resource(resourceId,"String_Node_Str",identityDetailsToJsonValue(checkIdent));
    handler.handleResult(resource);
  }
 catch (  final ObjectNotFound onf) {
    RestDispatcher.debug.error("String_Node_Str" + onf);
    handler.handleError(new NotFoundException("String_Node_Str" + resourceId + "String_Node_Str",onf));
  }
catch (  final NeedMoreCredentials needMoreCredentials) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ needMoreCredentials);
    handler.handleError(new ForbiddenException("String_Node_Str",needMoreCredentials));
  }
catch (  final TokenExpired tokenExpired) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ tokenExpired);
    handler.handleError(new PermanentException(401,"String_Node_Str",null));
  }
catch (  final AccessDenied accessDenied) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ accessDenied);
    handler.handleError(new ForbiddenException(accessDenied.getMessage(),accessDenied));
  }
catch (  final GeneralFailure generalFailure) {
    RestDispatcher.debug.error("String_Node_Str" + generalFailure);
    handler.handleError(new BadRequestException(generalFailure.getMessage(),generalFailure));
  }
catch (  BadRequestException bre) {
    RestDispatcher.debug.error("String_Node_Str" + resourceId + "String_Node_Str"+ bre);
    handler.handleError(bre);
  }
catch (  final Exception exception) {
    RestDispatcher.debug.error("String_Node_Str" + exception);
    handler.handleError(new NotFoundException(exception.getMessage(),exception));
  }
}