nus-yam/ex-repair huggingface dataset:
Program: 79681
Project: 79681
Buggy source:
/** 
 * Given the calling context and the privilege definition attempts to authorise the calling subject.
 * @param context the server context
 * @param definition the privilege definition
 * @return the authorisation result
 */
private Promise<AuthorizationResult,ResourceException> evaluate(final Context context,final PrivilegeDefinition definition){
  final String realm=(context.containsContext(RealmContext.class)) ? context.asContext(RealmContext.class).getResolvedRealm() : "String_Node_Str";
  final SubjectContext subjectContext=context.asContext(SubjectContext.class);
  final UriRouterContext routerContext=context.asContext(UriRouterContext.class);
  final Set<String> actions=transformSet(definition.getActions(),ACTION_TO_STRING_MAPPER);
  try {
    final DelegationPermission permissionRequest=permissionFactory.newInstance(realm,REST,VERSION,routerContext.getMatchedUri(),definition.getCommonVerb(),actions,Collections.<String,String>emptyMap());
    if (evaluator.isAllowed(subjectContext.getCallerSSOToken(),permissionRequest,Collections.<String,Set<String>>emptyMap())) {
      return Promises.newResultPromise(AuthorizationResult.accessPermitted());
    }
  }
 catch (  DelegationException dE) {
    return new InternalServerErrorException("String_Node_Str",dE).asPromise();
  }
catch (  SSOException ssoE) {
    return new InternalServerErrorException("String_Node_Str",ssoE).asPromise();
  }
  return Promises.newResultPromise(AuthorizationResult.accessDenied("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Given the calling context and the privilege definition attempts to authorise the calling subject.
 * @param context the server context
 * @param definition the privilege definition
 * @return the authorisation result
 */
private Promise<AuthorizationResult,ResourceException> evaluate(final Context context,final PrivilegeDefinition definition){
  final String realm=(context.containsContext(RealmContext.class)) ? context.asContext(RealmContext.class).getResolvedRealm() : "String_Node_Str";
  final SubjectContext subjectContext=context.asContext(SubjectContext.class);
  final UriRouterContext routerContext=context.asContext(UriRouterContext.class);
  final Set<String> actions=transformSet(definition.getActions(),ACTION_TO_STRING_MAPPER);
  try {
    final DelegationPermission permissionRequest=permissionFactory.newInstance(realm,REST,VERSION,routerContext.getMatchedUri(),definition.getCommonVerb(),actions,Collections.<String,String>emptyMap());
    if (evaluator.isAllowed(subjectContext.getCallerSSOToken(),permissionRequest,Collections.<String,Set<String>>emptyMap())) {
      return Promises.newResultPromise(AuthorizationResult.accessPermitted());
    }
  }
 catch (  DelegationException dE) {
    return new InternalServerErrorException("String_Node_Str",dE).asPromise();
  }
catch (  SSOException ssoE) {
    return Promises.newResultPromise(AuthorizationResult.accessDenied("String_Node_Str"));
  }
  return Promises.newResultPromise(AuthorizationResult.accessDenied("String_Node_Str"));
}
Program: 79682
Project: 79682
Buggy source:
@Test(expectedExceptions=ResourceException.class) public void shouldErrorInvalidContext() throws SSOException, ResourceException, InterruptedException {
  SSOTokenContext mockSSOTokenContext=mock(SSOTokenContext.class);
  SSOToken mockSSOToken=mock(SSOToken.class);
  given(mockSSOTokenContext.getCallerSSOToken()).willReturn(mockSSOToken);
  given(mockSSOToken.getProperty(Constants.UNIVERSAL_IDENTIFIER)).willThrow(new SSOException("String_Node_Str"));
  Promise<AuthorizationResult,ResourceException> result=testModule.authorize(mockSSOTokenContext);
  result.getOrThrow();
}

Fixed version (ground truth):
@Test public void shouldErrorInvalidContext() throws SSOException, ResourceException, InterruptedException, ExecutionException {
  SSOTokenContext mockSSOTokenContext=mock(SSOTokenContext.class);
  SSOToken mockSSOToken=mock(SSOToken.class);
  given(mockSSOTokenContext.getCallerSSOToken()).willReturn(mockSSOToken);
  given(mockSSOToken.getProperty(Constants.UNIVERSAL_IDENTIFIER)).willThrow(new SSOException("String_Node_Str"));
  Promise<AuthorizationResult,ResourceException> result=testModule.authorize(mockSSOTokenContext);
  assertFalse(result.get().isAuthorized());
}
Program: 79683
Project: 79683
Buggy source:
private boolean auditAuthenticationEvent(String description,String transactionId,String authentication,String realmName,long time,Map<String,String> contexts,List<?> entries){
  boolean couldHandleEvent=true;
  AMAuthenticationAuditEventBuilder builder=authenticationAuditor.authenticationEvent();
  builder.transactionId(transactionId).authentication(authentication).timestamp(time).component(AuditConstants.Component.AUTHENTICATION);
  if (StringUtils.isNotEmpty(description)) {
    builder.eventName(description);
  }
  if (StringUtils.isNotEmpty(realmName)) {
    builder.realm(realmName);
  }
  if (contexts != null && !contexts.isEmpty()) {
    builder.contexts(contexts);
  }
  if (entries != null && !entries.isEmpty()) {
    builder.entries(entries);
  }
  try {
    authenticationAuditor.publish(builder.toEvent());
  }
 catch (  AuditException e) {
    couldHandleEvent=false;
  }
  return couldHandleEvent;
}

Fixed version (ground truth):
private boolean auditAuthenticationEvent(String description,String transactionId,String authentication,String realmName,long time,Map<String,String> contexts,List<Entry> entries){
  boolean couldHandleEvent=true;
  AMAuthenticationAuditEventBuilder builder=authenticationAuditor.authenticationEvent();
  builder.transactionId(transactionId).authentication(authentication).timestamp(time).component(AuditConstants.Component.AUTHENTICATION);
  if (StringUtils.isNotEmpty(description)) {
    builder.eventName(description);
  }
  if (StringUtils.isNotEmpty(realmName)) {
    builder.realm(realmName);
  }
  if (contexts != null && !contexts.isEmpty()) {
    builder.contexts(contexts);
  }
  if (entries != null && !entries.isEmpty()) {
    List<Map<String,Object>> list=new ArrayList<>();
    for (    Entry entry : entries) {
      Map<String,Object> map=new HashMap<>();
      map.put("String_Node_Str",entry.getModuleId());
      map.put("String_Node_Str",entry.getResult());
      map.put("String_Node_Str",entry.getInfo());
      list.add(map);
    }
    builder.entries(list);
  }
  try {
    authenticationAuditor.publish(builder.toEvent());
  }
 catch (  AuditException e) {
    couldHandleEvent=false;
  }
  return couldHandleEvent;
}
Program: 79687
Project: 79687
Buggy source:
/** 
 * Set the result.
 * @param result The result.
 */
public void setResult(EventOutcome result){
  this.entry.put(RESULT_KEY,result);
}

Fixed version (ground truth):
/** 
 * Set the result.
 * @param result The result.
 */
public void setResult(AuthenticationAuditEventBuilder.Status result){
  this.entry.put(RESULT_KEY,result);
}
Program: 79688
Project: 79688
Buggy source:
/** 
 * Get the result.
 * @return The result.
 */
public EventOutcome getResult(){
  return (EventOutcome)this.entry.get(RESULT_KEY);
}

Fixed version (ground truth):
/** 
 * Get the result.
 * @return The result.
 */
public AuthenticationAuditEventBuilder.Status getResult(){
  return (AuthenticationAuditEventBuilder.Status)this.entry.get(RESULT_KEY);
}
Program: 79693
Project: 79693
Buggy source:
private String getCodeVerifier(String codeChallengeMethod) throws LoginException {
  String codeVerifier=Base64url.encode(RandomStringUtils.randomAlphanumeric(96).getBytes());
  if (SHA_256_DISPLAY_NAME.equals(codeChallengeMethod)) {
    try {
      return Base64url.encode(MessageDigest.getInstance("String_Node_Str").digest(codeVerifier.getBytes(StandardCharsets.US_ASCII)));
    }
 catch (    NoSuchAlgorithmException e) {
      throw new LoginException("String_Node_Str");
    }
  }
 else {
    return codeVerifier;
  }
}

Fixed version (ground truth):
private String getCodeVerifier(String codeChallengeMethod) throws LoginException {
  String codeVerifier=Base64url.encode(RandomStringUtils.randomAlphanumeric(96).getBytes());
  if (OAuth2Constants.Custom.CODE_CHALLENGE_METHOD_S_256.equals(codeChallengeMethod)) {
    try {
      return Base64url.encode(MessageDigest.getInstance("String_Node_Str").digest(codeVerifier.getBytes(StandardCharsets.US_ASCII)));
    }
 catch (    NoSuchAlgorithmException e) {
      throw new LoginException("String_Node_Str");
    }
  }
 else {
    return codeVerifier;
  }
}
Program: 79694
Project: 79694
Buggy source:
@Override protected String getContextIdForAccessAttempt(Request request){
  try {
    String jsonString=request.getEntity().getString();
    if (isNotEmpty(jsonString)) {
      JsonValue jsonValue=toJsonValue(jsonString);
      if (jsonValue.isDefined(AUTH_ID)) {
        populateContextFromAuthId(jsonValue.get(AUTH_ID).asString());
      }
    }
    return super.getContextIdForAccessAttempt(request);
  }
 catch (  IOException e) {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
protected String getContextIdForAccessAttempt(Request request){
  try {
    String jsonString=request.getEntity().getString();
    if (isNotEmpty(jsonString)) {
      JsonValue jsonValue=toJsonValue(jsonString);
      if (jsonValue.isDefined(AUTH_ID)) {
        populateContextFromAuthId(jsonValue.get(AUTH_ID).asString());
      }
    }
  }
 catch (  IOException e) {
    return "String_Node_Str";
  }
  return null;
}
Program: 79695
Project: 79695
Buggy source:
@Override protected String getContextIdForAccessOutcome(Response response){
  String contextId=super.getContextIdForAccessOutcome(response);
  if (isNotEmpty(contextId)) {
    return contextId;
  }
  String tokenId=AuditRequestContext.getProperty(TOKEN_ID);
  String sessionId=AuditRequestContext.getProperty(SESSION_ID);
  String authId=AuditRequestContext.getProperty(AUTH_ID);
  if (isNotEmpty(tokenId)) {
    populateContextFromTokenId(tokenId);
  }
 else   if (isNotEmpty(sessionId)) {
    AuditRequestContext.putProperty(CONTEXT_ID,getContextIdFromSessionId(sessionId));
  }
 else   if (isNotEmpty(authId)) {
    populateContextFromAuthId(authId);
  }
  return super.getContextIdForAccessOutcome(response);
}

Fixed version (ground truth):
protected String getContextIdForAccessOutcome(Response response){
  String tokenId=AuditRequestContext.getProperty(TOKEN_ID);
  String sessionId=AuditRequestContext.getProperty(SESSION_ID);
  String authId=AuditRequestContext.getProperty(AUTH_ID);
  if (isNotEmpty(tokenId)) {
    populateContextFromTokenId(tokenId);
  }
 else   if (isNotEmpty(sessionId)) {
  }
 else   if (isNotEmpty(authId)) {
    populateContextFromAuthId(authId);
  }
  return null;
}
Program: 79696
Project: 79696
Buggy source:
private void populateContextFromAuthId(String authId){
  try {
    String sessionId=authIdHelper.reconstructAuthId(authId).getClaimsSet().getClaim(SESSION_ID,String.class);
    if (isEmpty(sessionId)) {
      return;
    }
    String contextId=getContextIdFromSessionId(sessionId);
    if (isNotEmpty(contextId)) {
      AuditRequestContext.putProperty(CONTEXT_ID,contextId);
    }
  }
 catch (  RestAuthException e) {
    debug.warning("String_Node_Str");
  }
}

Fixed version (ground truth):
private void populateContextFromAuthId(String authId){
  try {
    String sessionId=authIdHelper.reconstructAuthId(authId).getClaimsSet().getClaim(SESSION_ID,String.class);
    if (isEmpty(sessionId)) {
      return;
    }
    String contextId=getContextIdFromSessionId(sessionId);
    if (isNotEmpty(contextId)) {
    }
  }
 catch (  RestAuthException e) {
    debug.warning("String_Node_Str");
  }
}
Program: 79697
Project: 79697
Buggy source:
private void populateContextFromTokenId(String tokenId){
  try {
    SSOToken token=SSOTokenManager.getInstance().createSSOToken(tokenId);
    AuditRequestContext.putProperty(USER_ID,getUserId(token));
    AuditRequestContext.putProperty(CONTEXT_ID,getContextIdFromSSOToken(token));
  }
 catch (  SSOException e) {
    debug.warning("String_Node_Str");
  }
}

Fixed version (ground truth):
private void populateContextFromTokenId(String tokenId){
  try {
    SSOToken token=SSOTokenManager.getInstance().createSSOToken(tokenId);
    AuditRequestContext.putProperty(USER_ID,getUserId(token));
  }
 catch (  SSOException e) {
    debug.warning("String_Node_Str");
  }
}
Program: 79698
Project: 79698
Buggy source:
private void auditAccessSuccess(Request request,Response response){
  if (auditEventPublisher.isAuditing(ACCESS_TOPIC)) {
    long endTime=System.currentTimeMillis();
    AMAccessAuditEventBuilder builder=auditEventFactory.accessEvent().timestamp(endTime).transactionId(AuditRequestContext.getTransactionIdValue()).eventName(EventName.AM_ACCESS_OUTCOME).component(component).authentication(getUserIdForAccessOutcome(response)).contextId(getContextIdForAccessOutcome(response)).response("String_Node_Str",endTime - request.getDate().getTime());
    addHttpData(request,builder);
    auditEventPublisher.tryPublish(ACCESS_TOPIC,builder.toEvent());
  }
}

Fixed version (ground truth):
private void auditAccessSuccess(Request request,Response response){
}
Program: 79699
Project: 79699
Buggy source:
private void addHttpData(Request request,AMAccessAuditEventBuilder builder){
  HttpServletRequest servletRequest=getRequest(request);
  if (servletRequest != null) {
    builder.forHttpServletRequest(servletRequest);
  }
}

Fixed version (ground truth):
private void addHttpData(Request request,AMAccessAuditEventBuilder builder){
}
Program: 79700
Project: 79700
Buggy source:
/** 
 * Retrieve the context ID for an access attempt.
 * @param request the restlet request
 * @return the context ID
 */
protected String getContextIdForAccessAttempt(Request request){
  return AuditRequestContext.getProperty(CONTEXT_ID);
}

Fixed version (ground truth):
/** 
 * Retrieve the context ID for an access attempt.
 * @param request the restlet request
 * @return the context ID
 */
protected String getContextIdForAccessAttempt(Request request){
  return null;
}
Program: 79701
Project: 79701
Buggy source:
/** 
 * Retrieve the user ID for an access outcome.
 * @param response the restlet response
 * @return the user ID
 */
protected String getUserIdForAccessOutcome(Response response){
  String userId=AuditRequestContext.getProperty(USER_ID);
  return userId == null ? "String_Node_Str" : userId;
}

Fixed version (ground truth):
/** 
 * Retrieve the user ID for an access outcome.
 * @param response the restlet response
 * @return the user ID
 */
protected String getUserIdForAccessOutcome(Response response){
  return null;
}
Program: 79702
Project: 79702
Buggy source:
@Override protected void afterHandle(Request request,Response response){
  super.afterHandle(request,response);
  if (response.getStatus().isError()) {
    auditAccessFailure(request,response);
  }
 else {
    auditAccessSuccess(request,response);
  }
}

Fixed version (ground truth):
@Override protected void afterHandle(Request request,Response response){
}
Program: 79703
Project: 79703
Buggy source:
/** 
 * Retrieve the Context ID for an access outcome.
 * @param response the restlet response
 * @return the context ID
 */
protected String getContextIdForAccessOutcome(Response response){
  return AuditRequestContext.getProperty(CONTEXT_ID);
}

Fixed version (ground truth):
/** 
 * Retrieve the Context ID for an access outcome.
 * @param response the restlet response
 * @return the context ID
 */
protected String getContextIdForAccessOutcome(Response response){
  return null;
}
Program: 79704
Project: 79704
Buggy source:
private void auditAccessFailure(Request request,Response response){
  if (auditEventPublisher.isAuditing(ACCESS_TOPIC)) {
    long endTime=System.currentTimeMillis();
    AMAccessAuditEventBuilder builder=auditEventFactory.accessEvent().timestamp(endTime).transactionId(AuditRequestContext.getTransactionIdValue()).eventName(EventName.AM_ACCESS_OUTCOME).component(component).authentication(getUserIdForAccessOutcome(response)).contextId(getContextIdForAccessOutcome(response)).responseWithMessage("String_Node_Str" + response.getStatus().getCode(),endTime - request.getDate().getTime(),response.getStatus().getDescription());
    addHttpData(request,builder);
    auditEventPublisher.tryPublish(ACCESS_TOPIC,builder.toEvent());
  }
}

Fixed version (ground truth):
private void auditAccessFailure(Request request,Response response){
}
Program: 79705
Project: 79705
Buggy source:
/** 
 * Retrieve the user ID for an access attempt.
 * @param request the restlet request
 * @return the user ID
 */
protected String getUserIdForAccessAttempt(Request request){
  String userId=AuditRequestContext.getProperty(USER_ID);
  return userId == null ? "String_Node_Str" : userId;
}

Fixed version (ground truth):
/** 
 * Retrieve the user ID for an access attempt.
 * @param request the restlet request
 * @return the user ID
 */
protected String getUserIdForAccessAttempt(Request request){
  return null;
}
Program: 79706
Project: 79706
Buggy source:
@Override protected int beforeHandle(Request request,Response response){
  try {
    Representation representation=request.getEntity();
    if (representation.isTransient()) {
      request.setEntity(new BufferingRepresentation(request.getEntity()));
    }
    auditAccessAttempt(request);
  }
 catch (  AuditException e) {
    response.setStatus(Status.SERVER_ERROR_INTERNAL,e);
    return STOP;
  }
  return CONTINUE;
}

Fixed version (ground truth):
@Override protected int beforeHandle(Request request,Response response){
  return 0;
}
Program: 79707
Project: 79707
Buggy source:
private void auditAccessAttempt(Request request) throws AuditException {
  if (auditEventPublisher.isAuditing(ACCESS_TOPIC)) {
    AMAccessAuditEventBuilder builder=auditEventFactory.accessEvent().timestamp(request.getDate().getTime()).transactionId(AuditRequestContext.getTransactionIdValue()).eventName(EventName.AM_ACCESS_ATTEMPT).component(component).authentication(getUserIdForAccessAttempt(request)).contextId(getContextIdForAccessAttempt(request));
    addHttpData(request,builder);
    auditEventPublisher.publish(ACCESS_TOPIC,builder.toEvent());
  }
}

Fixed version (ground truth):
private void auditAccessAttempt(Request request) throws AuditException {
}
Program: 79708
Project: 79708
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected String getContextIdForAccessAttempt(Request request){
  String contextId=super.getContextIdForAccessAttempt(request);
  if (contextId != null) {
    return contextId;
  }
  AccessToken accessToken=retrieveAccessToken(request);
  contextId=generateContextID(accessToken);
  AuditRequestContext.putProperty(CONTEXT_ID,contextId);
  return contextId;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected String getContextIdForAccessAttempt(Request request){
  return null;
}
Program: 79709
Project: 79709
Buggy source:
@Test public void shouldHandleAuditException() throws AuditException {
  Request request=mock(Request.class);
  Response response=new Response(request);
  Representation representation=mock(Representation.class);
  when(request.getEntity()).thenReturn(representation);
  when(request.getDate()).thenReturn(new Date());
  when(representation.isTransient()).thenReturn(false);
  AuditRequestContext.putProperty(USER_ID,"String_Node_Str");
  AuditRequestContext.putProperty(CONTEXT_ID,"String_Node_Str");
  when(eventPublisher.isAuditing(anyString())).thenReturn(true);
  when(eventPublisher.isSuppressExceptions()).thenReturn(false);
  doThrow(AuditException.class).when(eventPublisher).publish(anyString(),any(AuditEvent.class));
  auditFilter.handle(request,response);
  verify(restlet,never()).handle(any(Request.class),any(Response.class));
  assertThat(response.getStatus()).isEqualTo(Status.SERVER_ERROR_INTERNAL);
}

Fixed version (ground truth):
@Test public void shouldHandleAuditException() throws AuditException {
  Request request=mock(Request.class);
  Response response=new Response(request);
  Representation representation=mock(Representation.class);
  when(request.getEntity()).thenReturn(representation);
  when(request.getDate()).thenReturn(new Date());
  when(representation.isTransient()).thenReturn(false);
  AuditRequestContext.putProperty(USER_ID,"String_Node_Str");
  when(eventPublisher.isAuditing(anyString())).thenReturn(true);
  when(eventPublisher.isSuppressExceptions()).thenReturn(false);
  doThrow(AuditException.class).when(eventPublisher).publish(anyString(),any(AuditEvent.class));
  auditFilter.handle(request,response);
  verify(restlet,never()).handle(any(Request.class),any(Response.class));
  assertThat(response.getStatus()).isEqualTo(Status.SERVER_ERROR_INTERNAL);
}
Program: 79710
Project: 79710
Buggy source:
/** 
 * @return
 */
public static Map<String,String> getAllAvailableContexts(){
  Map<String,String> map=new HashMap<>();
  for (  AuditConstants.Context context : AuditConstants.Context.values()) {
    String contextKey=context.toString();
    String contextValue=AuditRequestContext.getProperty(contextKey);
    if (StringUtils.isNotEmpty(contextValue)) {
      map.put(contextKey,contextValue);
    }
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Get all available   {@link AuditConstants.Context} values from the possible list of{@link AuditConstants.Context} values, from the {@link AuditRequestContext}.
 * @return All the available {@link AuditConstants.Context} values.
 */
public static Map<String,String> getAllAvailableContexts(){
  Map<String,String> map=new HashMap<>();
  for (  AuditConstants.Context context : AuditConstants.Context.values()) {
    String contextKey=context.toString();
    String contextValue=AuditRequestContext.getProperty(contextKey);
    if (StringUtils.isNotEmpty(contextValue)) {
      map.put(contextKey,contextValue);
    }
  }
  return map;
}
Program: 79711
Project: 79711
Buggy source:
public void auditActivity(InternalSession session,EventName eventName){
  if (auditEventPublisher.isAuditing(ACTIVITY_TOPIC)) {
    String contextId=session.getProperty(Constants.AM_CTX_ID);
    AuditEvent auditEvent=auditEventFactory.activityEvent().transactionId(AuditRequestContext.getTransactionIdValue()).eventName(eventName).component(Component.SESSION).authentication(session.getProperty(Constants.UNIVERSAL_IDENTIFIER)).contextId(Context.SESSION,contextId).runAs(getUserId(getAdminToken())).resourceOperation(contextId,"String_Node_Str",getCrudType(eventName)).toEvent();
    auditEventPublisher.tryPublish(ACTIVITY_TOPIC,auditEvent);
  }
}

Fixed version (ground truth):
public void auditActivity(InternalSession session,EventName eventName){
  if (auditEventPublisher.isAuditing(ACTIVITY_TOPIC)) {
    String contextId=session.getProperty(Constants.AM_CTX_ID);
    AuditEvent auditEvent=auditEventFactory.activityEvent().transactionId(AuditRequestContext.getTransactionIdValue()).eventName(eventName).component(Component.SESSION).authentication(session.getProperty(Constants.UNIVERSAL_IDENTIFIER)).context(Context.SESSION,contextId).runAs(getUserId(getAdminToken())).resourceOperation(contextId,"String_Node_Str",getCrudType(eventName)).toEvent();
    auditEventPublisher.tryPublish(ACTIVITY_TOPIC,auditEvent);
  }
}
Program: 79713
Project: 79713
Buggy source:
/** 
 * Gets the instance of the OAuth2ProviderSettings.
 * @param realm The realm.
 * @param req The request that can be used to obtain the base deployment url.
 * @return The OAuth2ProviderSettings instance.
 */
OAuth2ProviderSettings get(String realm,HttpServletRequest req) throws NotFoundException ;

Fixed version (ground truth):
/** 
 * Gets the instance of the OAuth2ProviderSettings.
 * @param realm The realm.
 * @param context The context that can be used to obtain the base deployment url.
 * @return The OAuth2ProviderSettings instance.
 */
OAuth2ProviderSettings get(String realm,Context context) throws NotFoundException ;
Program: 79714
Project: 79714
Buggy source:
/** 
 * Cache each provider settings on the realm it was created for.  {@inheritDoc}
 */
public OAuth2ProviderSettings get(String realm,HttpServletRequest req) throws NotFoundException {
  String baseDeploymentUri=baseURLProviderFactory.get(realm).getURL(req);
synchronized (providerSettingsMap) {
    OAuth2ProviderSettings providerSettings=providerSettingsMap.get(realm);
    if (providerSettings == null) {
      ResourceSetStore resourceSetStore=resourceSetStoreFactory.create(realm);
      providerSettings=new OpenAMOAuth2ProviderSettings(realm,baseDeploymentUri,resourceSetStore,cookieExtractor);
      if (providerSettings.exists()) {
        providerSettingsMap.put(realm,providerSettings);
      }
 else {
        throw new NotFoundException("String_Node_Str" + realm);
      }
    }
    return providerSettings;
  }
}

Fixed version (ground truth):
@Override public OAuth2ProviderSettings get(String realm,Context context) throws NotFoundException {
  Reject.ifNull(realm,"String_Node_Str");
  Reject.ifNull(context,"String_Node_Str");
  String baseDeploymentUri=baseURLProviderFactory.get(realm).getURL(context.asContext(HttpContext.class));
  return getProviderSettings(realm,baseDeploymentUri);
}
Program: 79715
Project: 79715
Buggy source:
@Override public void addRoutes(RestRouter rootRouter,RestRouter realmRouter){
  realmRouter.route("String_Node_Str").auditAs(OAUTH2).authorizeWith(ResourceOwnerOrSuperUserAuthzModule.class).through(UmaEnabledFilter.class).toCollection(ResourceSetResource.class);
  realmRouter.route("String_Node_Str").auditAs(OAUTH2).authorizeWith(ResourceOwnerOrSuperUserAuthzModule.class).toCollection(UmaLabelResource.class);
}

Fixed version (ground truth):
@Override public void addRoutes(RestRouter rootRouter,RestRouter realmRouter){
  realmRouter.route("String_Node_Str").auditAs(OAUTH2).authorizeWith(ResourceOwnerOrSuperUserAuthzModule.class).through(UmaEnabledFilter.class).toCollection(ResourceSetResource.class);
  realmRouter.route("String_Node_Str").auditAs(OAUTH2).authorizeWith(ResourceOwnerOrSuperUserAuthzModule.class).through(UmaEnabledFilter.class).toCollection(UmaLabelResource.class);
}
Program: 79716
Project: 79716
Buggy source:
public void setResourceSetQuery(org.forgerock.util.query.QueryFilter<String> query){
  setFirstQuery(query);
}

Fixed version (ground truth):
/** 
 * Set the resource set query.
 * @param query The query.
 */
public void setResourceSetQuery(org.forgerock.util.query.QueryFilter<String> query){
  setFirstQuery(query);
}
Program: 79717
Project: 79717
Buggy source:
public QueryFilter getPolicyQuery(){
  return getSecondQuery();
}

Fixed version (ground truth):
/** 
 * Get the policy query.
 * @return The query.
 */
public QueryFilter<JsonPointer> getPolicyQuery(){
  return getSecondQuery();
}
Program: 79718
Project: 79718
Buggy source:
public org.forgerock.util.query.QueryFilter<String> getResourceSetQuery(){
  return getFirstQuery();
}

Fixed version (ground truth):
/** 
 * Get the resource set query.
 * @return The query.
 */
public org.forgerock.util.query.QueryFilter<String> getResourceSetQuery(){
  return getFirstQuery();
}
Program: 79719
Project: 79719
Buggy source:
public void setPolicyQuery(QueryFilter query){
  setSecondQuery(query);
}

Fixed version (ground truth):
/** 
 * Set the policy query.
 * @param query The query.
 */
public void setPolicyQuery(QueryFilter<JsonPointer> query){
  setSecondQuery(query);
}
Program: 79720
Project: 79720
Buggy source:
private Promise<Void,ResourceException> enabled(Context serverContext){
  try {
    final String realm=ServerContextUtils.getRealm(serverContext);
    UmaProviderSettings settings=umaProviderSettingsFactory.get(RequestHolder.get(),realm);
    if (settings.isEnabled()) {
      return newResultPromise(null);
    }
  }
 catch (  NotFoundException ignore) {
  }
  return newExceptionPromise(newNotSupportedException("String_Node_Str"));
}

Fixed version (ground truth):
private Promise<Void,ResourceException> enabled(Context serverContext){
  try {
    final String realm=ServerContextUtils.getRealm(serverContext);
    UmaProviderSettings settings=umaProviderSettingsFactory.get(serverContext,realm);
    if (settings.isEnabled()) {
      return newResultPromise(null);
    }
  }
 catch (  NotFoundException ignore) {
  }
  return newExceptionPromise(newNotSupportedException("String_Node_Str"));
}
Program: 79722
Project: 79722
Buggy source:
@Test public void getResourceSetsShouldReturnEmptySetWhenNoResourceSetsExist() throws Exception {
  String realm="String_Node_Str";
  Context context=mockContext(realm);
  ResourceSetWithPolicyQuery query=new ResourceSetWithPolicyQuery();
  String resourceOwnerId="String_Node_Str";
  boolean augmentWithPolicies=false;
  QueryFilter<String> resourceSetQuery=mock(QueryFilter.class);
  QueryFilter policyQuery=QueryFilter.alwaysFalse();
  Set<ResourceSetDescription> queriedResourceSets=new HashSet<>();
  Collection<UmaPolicy> queriedPolicies=new HashSet<>();
  Pair<QueryResponse,Collection<UmaPolicy>> queriedPoliciesPair=Pair.of(newQueryResponse(),queriedPolicies);
  Promise<Pair<QueryResponse,Collection<UmaPolicy>>,ResourceException> queriedPoliciesPromise=Promises.newResultPromise(queriedPoliciesPair);
  query.setResourceSetQuery(resourceSetQuery);
  query.setPolicyQuery(policyQuery);
  given(resourceSetStore.query(any(QueryFilter.class))).willReturn(queriedResourceSets);
  given(policyService.queryPolicies(eq(context),Matchers.<QueryRequest>anyObject())).willReturn(queriedPoliciesPromise);
  mockResourceOwnerIdentity(resourceOwnerId,realm);
  mockPolicyEvaluator("String_Node_Str");
  mockFilteredResourceSetsQueryVisitor(resourceSetQuery,queriedResourceSets);
  Collection<ResourceSetDescription> resourceSets=service.getResourceSets(context,realm,query,resourceOwnerId,augmentWithPolicies).getOrThrowUninterruptibly();
  assertThat(resourceSets).isEmpty();
}

Fixed version (ground truth):
@Test public void getResourceSetsShouldReturnEmptySetWhenNoResourceSetsExist() throws Exception {
  String realm="String_Node_Str";
  Context context=mockContext(realm);
  ResourceSetWithPolicyQuery query=new ResourceSetWithPolicyQuery();
  String resourceOwnerId="String_Node_Str";
  boolean augmentWithPolicies=false;
  QueryFilter<String> resourceSetQuery=mock(QueryFilter.class);
  QueryFilter<JsonPointer> policyQuery=QueryFilter.alwaysFalse();
  Set<ResourceSetDescription> queriedResourceSets=new HashSet<>();
  Collection<UmaPolicy> queriedPolicies=new HashSet<>();
  Pair<QueryResponse,Collection<UmaPolicy>> queriedPoliciesPair=Pair.of(newQueryResponse(),queriedPolicies);
  Promise<Pair<QueryResponse,Collection<UmaPolicy>>,ResourceException> queriedPoliciesPromise=Promises.newResultPromise(queriedPoliciesPair);
  query.setResourceSetQuery(resourceSetQuery);
  query.setPolicyQuery(policyQuery);
  given(resourceSetStore.query(any(QueryFilter.class))).willReturn(queriedResourceSets);
  given(policyService.queryPolicies(eq(context),Matchers.<QueryRequest>anyObject())).willReturn(queriedPoliciesPromise);
  mockResourceOwnerIdentity(resourceOwnerId,realm);
  mockPolicyEvaluator("String_Node_Str");
  mockFilteredResourceSetsQueryVisitor(resourceSetQuery,queriedResourceSets);
  Collection<ResourceSetDescription> resourceSets=service.getResourceSets(context,realm,query,resourceOwnerId,augmentWithPolicies).getOrThrowUninterruptibly();
  assertThat(resourceSets).isEmpty();
}
Program: 79723
Project: 79723
Buggy source:
@BeforeClass public static void setupFactories() throws Exception {
  notYetConfiguredFactory=mock(UmaProviderSettingsFactory.class);
  given(notYetConfiguredFactory.get(any(HttpServletRequest.class),anyString())).willThrow(NotFoundException.class);
  UmaProviderSettings notEnabled=mock(UmaProviderSettings.class);
  given(notEnabled.isEnabled()).willReturn(false);
  notEnabledFactory=mock(UmaProviderSettingsFactory.class);
  given(notEnabledFactory.get(any(HttpServletRequest.class),anyString())).willReturn(notEnabled);
  UmaProviderSettings enabled=mock(UmaProviderSettings.class);
  given(enabled.isEnabled()).willReturn(true);
  enabledFactory=mock(UmaProviderSettingsFactory.class);
  given(enabledFactory.get(any(HttpServletRequest.class),anyString())).willReturn(enabled);
}

Fixed version (ground truth):
@BeforeClass public static void setupFactories() throws Exception {
  notYetConfiguredFactory=mock(UmaProviderSettingsFactory.class);
  given(notYetConfiguredFactory.get(any(Context.class),anyString())).willThrow(NotFoundException.class);
  UmaProviderSettings notEnabled=mock(UmaProviderSettings.class);
  given(notEnabled.isEnabled()).willReturn(false);
  notEnabledFactory=mock(UmaProviderSettingsFactory.class);
  given(notEnabledFactory.get(any(Context.class),anyString())).willReturn(notEnabled);
  UmaProviderSettings enabled=mock(UmaProviderSettings.class);
  given(enabled.isEnabled()).willReturn(true);
  enabledFactory=mock(UmaProviderSettingsFactory.class);
  given(enabledFactory.get(any(Context.class),anyString())).willReturn(enabled);
}
Program: 79724
Project: 79724
Buggy source:
@BeforeMethod public void setup() throws Exception {
  MockitoAnnotations.initMocks(this);
  context=new InternalContext(new RealmContext(new RootContext()));
  requestHandler=mock(RequestHandler.class);
  when(requestHandler.handleAction(any(Context.class),any(ActionRequest.class))).thenReturn(promise(newActionResponse(null)));
  when(requestHandler.handleCreate(any(Context.class),any(CreateRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleDelete(any(Context.class),any(DeleteRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handlePatch(any(Context.class),any(PatchRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleQuery(any(Context.class),any(QueryRequest.class),any(QueryResourceHandler.class))).thenReturn(promise(newQueryResponse()));
  when(requestHandler.handleRead(any(Context.class),any(ReadRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleUpdate(any(Context.class),any(UpdateRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  RequestHolder.set(mock(HttpServletRequest.class));
}

Fixed version (ground truth):
@BeforeMethod public void setup() throws Exception {
  MockitoAnnotations.initMocks(this);
  context=new InternalContext(new RealmContext(new RootContext()));
  requestHandler=mock(RequestHandler.class);
  when(requestHandler.handleAction(any(Context.class),any(ActionRequest.class))).thenReturn(promise(newActionResponse(null)));
  when(requestHandler.handleCreate(any(Context.class),any(CreateRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleDelete(any(Context.class),any(DeleteRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handlePatch(any(Context.class),any(PatchRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleQuery(any(Context.class),any(QueryRequest.class),any(QueryResourceHandler.class))).thenReturn(promise(newQueryResponse()));
  when(requestHandler.handleRead(any(Context.class),any(ReadRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
  when(requestHandler.handleUpdate(any(Context.class),any(UpdateRequest.class))).thenReturn(promise(newResourceResponse(null,null,null)));
}
Program: 79725
Project: 79725
Buggy source:
/** 
 * <p>Gets the instance of the UmaProviderSettings.</p> <p>Cache each provider settings on the realm it was created for.</p>
 * @param request The request instance from which the base URL can be deduced.
 * @param realm The realm.
 * @return The OAuth2ProviderSettings instance.
 */
public UmaProviderSettings get(HttpServletRequest request,String realm) throws NotFoundException {
synchronized (providerSettingsMap) {
    UmaProviderSettingsImpl providerSettings=providerSettingsMap.get(realm);
    if (providerSettings == null) {
      OAuth2ProviderSettings oAuth2ProviderSettings=oAuth2ProviderSettingsFactory.get(realm,request);
      String baseUrlPattern=baseURLProviderFactory.get(realm).getURL(request);
      UmaTokenStore tokenStore=tokenStoreFactory.create(realm);
      providerSettings=new UmaProviderSettingsImpl(realm,baseUrlPattern,tokenStore,oAuth2ProviderSettings);
      providerSettingsMap.put(realm,providerSettings);
    }
    return providerSettings;
  }
}

Fixed version (ground truth):
/** 
 * <p>Gets the instance of the UmaProviderSettings.</p> <p>Cache each provider settings on the realm it was created for.</p>
 * @param context The context instance from which the base URL can be deduced.
 * @param realm The realm.
 * @return The OAuth2ProviderSettings instance.
 */
public UmaProviderSettings get(Context context,String realm) throws NotFoundException {
synchronized (providerSettingsMap) {
    UmaProviderSettingsImpl providerSettings=providerSettingsMap.get(realm);
    if (providerSettings == null) {
      OAuth2ProviderSettings oAuth2ProviderSettings=oAuth2ProviderSettingsFactory.get(realm,context);
      String baseUrlPattern=baseURLProviderFactory.get(realm).getURL(context.asContext(HttpContext.class));
      providerSettings=getUmaProviderSettings(realm,oAuth2ProviderSettings,baseUrlPattern);
    }
    return providerSettings;
  }
}
Program: 79726
Project: 79726
Buggy source:
@Provides @Singleton Iterator<HttpRouteProvider> getHttpRouteProviders(){
  return ServiceLoader.load(HttpRouteProvider.class).iterator();
}

Fixed version (ground truth):
@Provides @Singleton Iterable<HttpRouteProvider> getHttpRouteProviders(){
  return ServiceLoader.load(HttpRouteProvider.class);
}
Program: 79727
Project: 79727
Buggy source:
Handler getHandler(){
  return handler.get();
}

Fixed version (ground truth):
Handler getHandler(){
  return new Handler(){
    @Override public Promise<Response,NeverThrowsException> handle(    Context context,    Request request){
      return handler.get().handle(context,request);
    }
  }
;
}
Program: 79728
Project: 79728
Buggy source:
AuthenticationFilter(CrestAuthenticationFilter authenticationFilter,AuthenticationModule authenticationModule){
  this.authenticationFilter=authenticationFilter;
  this.authenticationModule=authenticationModule;
}

Fixed version (ground truth):
AuthenticationFilter(Filter authenticationFilter,AuthenticationModule authenticationModule){
  this.authenticationFilter=authenticationFilter;
  this.authenticationModule=authenticationModule;
}
Program: 79729
Project: 79729
Buggy source:
@BeforeClass public void setupMocks(){
  restletXACMLServiceServlet=mock(RestletServiceServlet.class);
  restletOAuth2ServiceServlet=mock(RestletServiceServlet.class);
  restletUMAServiceServlet=mock(RestletServiceServlet.class);
}

Fixed version (ground truth):
@BeforeClass public void setupMocks(){
  restletXACMLServiceServlet=mock(RestletServiceServlet.class);
  restletOAuth2ServiceServlet=mock(RestletServiceServlet.class);
  restletUMAServiceServlet=mock(RestletServiceServlet.class);
  restletXACMLHttpServlet=mock(HttpServlet.class);
  authenticationFilter=mock(Filter.class);
}
Program: 79730
Project: 79730
Buggy source:
@Test(dataProvider="String_Node_Str") public void shouldHandleRequestWithRestletServlet(String path,RestletServiceServlet servlet) throws Exception {
  HttpServletRequest request=mock(HttpServletRequest.class);
  HttpServletResponse response=mock(HttpServletResponse.class);
  given(request.getServletPath()).willReturn(path);
  restEndpointServlet.service(request,response);
  verify(servlet).service(Matchers.<HttpServletRequest>anyObject(),eq(response));
  for (  RestletServiceServlet s : Arrays.asList(restletXACMLServiceServlet,restletOAuth2ServiceServlet,restletUMAServiceServlet)) {
    if (s != servlet) {
      verifyZeroInteractions(s);
    }
  }
}

Fixed version (ground truth):
@Test(dataProvider="String_Node_Str",enabled=false) public void shouldHandleRequestWithRestletServlet(String path,HttpServlet servlet) throws Exception {
  HttpServletRequest request=mock(HttpServletRequest.class);
  HttpServletResponse response=mock(HttpServletResponse.class);
  given(request.getHeaderNames()).willReturn(Collections.enumeration(Collections.emptySet()));
  given(request.getAttributeNames()).willReturn(Collections.enumeration(Collections.emptySet()));
  given(request.getServletPath()).willReturn(path);
  restEndpointServlet.init();
  restEndpointServlet.service(request,response);
  verify(servlet).service(Matchers.<HttpServletRequest>anyObject(),eq(response));
  for (  HttpServlet s : Arrays.asList(restletXACMLHttpServlet,restletOAuth2ServiceServlet,restletUMAServiceServlet)) {
    if (s != servlet) {
      verifyZeroInteractions(s);
    }
  }
}
Program: 79731
Project: 79731
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] restletPathData(){
  return new Object[][]{{"String_Node_Str",restletXACMLServiceServlet},{"String_Node_Str",restletOAuth2ServiceServlet},{"String_Node_Str",restletUMAServiceServlet}};
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] restletPathData(){
  return new Object[][]{{"String_Node_Str",restletXACMLHttpServlet},{"String_Node_Str",restletOAuth2ServiceServlet},{"String_Node_Str",restletUMAServiceServlet}};
}
Program: 79732
Project: 79732
Buggy source:
@BeforeMethod public void setUp(){
  reset(restletXACMLServiceServlet);
  reset(restletOAuth2ServiceServlet);
  reset(restletUMAServiceServlet);
  restEndpointServlet=new RestEndpointServlet(restletXACMLServiceServlet,restletOAuth2ServiceServlet,restletUMAServiceServlet);
}

Fixed version (ground truth):
@BeforeMethod public void setUp(){
  reset(restletXACMLServiceServlet,restletOAuth2ServiceServlet,restletUMAServiceServlet,restletXACMLHttpServlet,authenticationFilter);
  restEndpointServlet=new RestEndpointServlet(restletXACMLServiceServlet,restletOAuth2ServiceServlet,restletUMAServiceServlet,restletXACMLHttpServlet,authenticationFilter);
}
Program: 79734
Project: 79734
Buggy source:
/** 
 * @return the value of the default CTS root suffix
 */
@VisibleForTesting DN getDefaultRootSuffix(){
  return defaultRootSuffix;
}

Fixed version (ground truth):
/** 
 * @return the value of the default CTS root suffix
 */
public DN getDefaultRootSuffix(){
  return defaultRootSuffix;
}
Program: 79735
Project: 79735
Buggy source:
/** 
 * Performs the upgrade by traversing through the candidate LDIF files and tries to process them. If embedded configuration store is used the indexes are also rebuilt as part of the upgrade. That will make sure that the newly created indexes are all operational.
 * @throws UpgradeException If there was an error while processing the LDIF files.
 */
public void upgrade() throws UpgradeException {
  Connection conn=null;
  try {
    conn=connFactory.create();
    for (    Upgrader upgrader : upgraders) {
      processLDIF(conn,upgrader.getLDIFPath());
    }
  }
 catch (  DataLayerException ere) {
    DEBUG.error("String_Node_Str",ere);
    throw new UpgradeException(ere);
  }
 finally {
    IOUtils.closeIfNotNull(conn);
  }
  if (EmbeddedOpenDS.isStarted()) {
    if (DEBUG.messageEnabled()) {
      DEBUG.message("String_Node_Str");
    }
    Map<String,String> rebuildIndexData=new HashMap<String,String>(2);
    rebuildIndexData.put(SetupConstants.CONFIG_VAR_BASE_DIR,baseDir);
    rebuildIndexData.put(SetupConstants.CONFIG_VAR_ROOT_SUFFIX,baseDN);
    try {
      EmbeddedOpenDS.rebuildIndex(rebuildIndexData);
    }
 catch (    Exception ex) {
      throw new UpgradeException(ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs the upgrade by traversing through the candidate LDIF files and tries to process them. If embedded configuration store is used the indexes are also rebuilt as part of the upgrade. That will make sure that the newly created indexes are all operational.
 * @throws UpgradeException If there was an error while processing the LDIF files.
 */
public void upgrade() throws UpgradeException {
  Connection conn=null;
  try {
    conn=connFactory.create();
    for (    Upgrader upgrader : upgraders) {
      processLDIF(conn,upgrader.getLDIFPath());
    }
  }
 catch (  DataLayerException ere) {
    DEBUG.error("String_Node_Str",ere);
    throw new UpgradeException(ere);
  }
 finally {
    IOUtils.closeIfNotNull(conn);
  }
  if (isEmbedded) {
    if (DEBUG.messageEnabled()) {
      DEBUG.message("String_Node_Str");
    }
    Map<String,String> rebuildIndexData=new HashMap<String,String>(2);
    rebuildIndexData.put(SetupConstants.CONFIG_VAR_BASE_DIR,baseDir);
    rebuildIndexData.put(SetupConstants.CONFIG_VAR_ROOT_SUFFIX,baseDN);
    try {
      EmbeddedOpenDS.rebuildIndex(rebuildIndexData);
    }
 catch (    Exception ex) {
      throw new UpgradeException(ex);
    }
  }
}
Program: 79737
Project: 79737
Buggy source:
private JsonValue parseOptions(String options){
  if (options == null) {
    return json("String_Node_Str");
  }
  if (KEY_VALUE_PAIR_REGEX.matcher(options).matches()) {
    JsonValue optionsValue=json(object());
    for (    String pair : options.split("String_Node_Str")) {
      String[] keyValue=pair.trim().split("String_Node_Str");
      if (keyValue.length != 2) {
        return json(options);
      }
      optionsValue.add(keyValue[0],keyValue[1]);
    }
    return optionsValue;
  }
 else {
    return json(options);
  }
}

Fixed version (ground truth):
private JsonValue parseOptions(String options){
  if (options == null || options.isEmpty()) {
    return json(object());
  }
  if (KEY_VALUE_PAIR_REGEX.matcher(options).matches()) {
    JsonValue optionsValue=json(object());
    for (    String pair : options.split("String_Node_Str")) {
      String[] keyValue=pair.trim().split("String_Node_Str");
      if (keyValue.length != 2) {
        return json(options);
      }
      optionsValue.add(keyValue[0],keyValue[1]);
    }
    return optionsValue;
  }
 else {
    return json(options);
  }
}
Program: 79738
Project: 79738
Buggy source:
private JsonValue transformRequestBody(JsonValue body) throws InternalServerErrorException {
  if (body.isDefined("String_Node_Str")) {
    try {
      List<AuthConfigurationEntry> entries=new ArrayList<>();
      for (      JsonValue entry : body.get("String_Node_Str")) {
        String module=entry.get("String_Node_Str").asString();
        String criteria=entry.get("String_Node_Str").asString();
        String options;
        if (entry.get("String_Node_Str").isString()) {
          options=entry.get("String_Node_Str").asString();
        }
 else {
          StringBuilder optionsBuilder=new StringBuilder();
          for (          Map.Entry<String,String> option : entry.get("String_Node_Str").asMap(String.class).entrySet()) {
            optionsBuilder.append(option.getKey()).append("String_Node_Str").append(option.getValue()).append("String_Node_Str");
          }
          options=optionsBuilder.substring(0,optionsBuilder.length() - 1);
        }
        entries.add(new AuthConfigurationEntry(module,criteria,options));
      }
      body.put("String_Node_Str",AMAuthConfigUtils.authConfigurationEntryToXMLString(entries));
    }
 catch (    AMConfigurationException e) {
      throw new InternalServerErrorException("String_Node_Str",e);
    }
  }
  return body;
}

Fixed version (ground truth):
private JsonValue transformRequestBody(JsonValue body) throws InternalServerErrorException {
  if (body.isDefined("String_Node_Str")) {
    try {
      List<AuthConfigurationEntry> entries=new ArrayList<>();
      for (      JsonValue entry : body.get("String_Node_Str")) {
        String module=entry.get("String_Node_Str").asString();
        String criteria=entry.get("String_Node_Str").asString();
        String options=getOptions(entry);
        entries.add(new AuthConfigurationEntry(module,criteria,options));
      }
      body.put("String_Node_Str",AMAuthConfigUtils.authConfigurationEntryToXMLString(entries));
    }
 catch (    AMConfigurationException e) {
      throw new InternalServerErrorException("String_Node_Str",e);
    }
  }
  return body;
}