Program: 13189
Project: 13189
Buggy source:
@Override public Promise<ActionResponse,ResourceException> actionInstance(Context context,ActionRequest request){
  try {
    logger.debug("String_Node_Str",request.getAction(),request);
    JsonValue content=request.getContent();
    if (content == null || !content.isMap() || content.asMap().isEmpty()) {
      return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + request.getResourcePath() + "String_Node_Str"+ request.getAction()+ "String_Node_Str"));
    }
    String url=content.get(ARG_URL).required().asString();
    String method=content.get(ARG_METHOD).required().asString();
    JsonValue auth=content.get(ARG_AUTHENTICATE);
    Map<String,Object> headers=content.get(ARG_HEADERS).asMap();
    String contentType=content.get(ARG_CONTENT_TYPE).asString();
    String body=content.get(ARG_BODY).asString();
    boolean detectResultFormat=content.get(ARG_DETECT_RESULT_FORMAT).defaultTo(true).asBoolean();
    MediaType mediaType;
    if (contentType != null) {
      mediaType=new MediaType(contentType);
    }
 else {
      mediaType=MediaType.APPLICATION_JSON;
    }
    ClientResource cr=null;
    try {
      cr=new ClientResource(url);
      Map<String,Object> attrs=cr.getRequestAttributes();
      setAttributes(cr.getRequest(),attrs,headers);
      if (!auth.isNull()) {
        String type=auth.get("String_Node_Str").defaultTo("String_Node_Str").asString();
        if ("String_Node_Str".equalsIgnoreCase(type)) {
          String identifier=auth.get("String_Node_Str").required().asString();
          String secret=auth.get("String_Node_Str").required().asString();
          logger.debug("String_Node_Str",identifier,secret != null && secret.length() > 0);
          ChallengeResponse challengeResponse=new ChallengeResponse(ChallengeScheme.HTTP_BASIC,identifier,secret);
          cr.setChallengeResponse(challengeResponse);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(type)) {
          String token=auth.get("String_Node_Str").required().asString();
          logger.debug("String_Node_Str");
          Series<Header> extraHeaders=(Series<Header>)attrs.get("String_Node_Str");
          if (extraHeaders == null) {
            extraHeaders=new Series<Header>(Header.class);
          }
          extraHeaders.set("String_Node_Str","String_Node_Str" + token);
          attrs.put("String_Node_Str",extraHeaders);
        }
 else {
          return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + type + "String_Node_Str"+ request.getResourcePath()+ "String_Node_Str"+ request.getAction()));
        }
      }
      StringRepresentation rep=new StringRepresentation(body);
      rep.setMediaType(mediaType);
      Representation representation=null;
      try {
        if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.get();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.post(rep);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.put(rep);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.delete();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.head();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.options();
        }
 else {
          return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + method));
        }
      }
 catch (      org.restlet.resource.ResourceException e) {
        int code=e.getStatus().getCode();
        String text=null;
        Representation responseEntity=cr.getResponseEntity();
        if (responseEntity != null && !(responseEntity instanceof EmptyRepresentation)) {
          text=responseEntity.getText();
        }
        final ResourceException exception=ResourceException.getException(code,"String_Node_Str" + method + "String_Node_Str"+ e.getMessage(),e);
        if (text != null) {
          JsonValue detail=new JsonValue(new HashMap<String,Object>());
          detail.put("String_Node_Str",text);
          exception.setDetail(detail);
        }
        return Promises.newExceptionPromise(exception);
      }
      String text=representation.getText();
      logger.debug("String_Node_Str",text,cr.getResponseAttributes());
      if (detectResultFormat && representation.getMediaType().isCompatible(MediaType.APPLICATION_JSON)) {
        try {
          if (text != null && text.trim().length() > 0) {
            return Promises.newResultPromise(Responses.newActionResponse(JsonUtil.parseStringified(text)));
          }
 else {
            return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + url));
          }
        }
 catch (        Exception ex) {
          return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + text + "String_Node_Str"+ ex.getMessage(),ex));
        }
      }
 else {
        try {
          Map<String,Object> resultHeaders=new HashMap<String,Object>();
          Series<Header> respHeaders=(Series<Header>)cr.getResponseAttributes().get(HeaderConstants.ATTRIBUTE_HEADERS);
          if (respHeaders != null) {
            for (            Header param : respHeaders) {
              String name=param.getName();
              String value=param.getValue();
              resultHeaders.put(name,value);
              logger.debug("String_Node_Str",name,value);
            }
          }
          JsonValue result=new JsonValue(new HashMap<String,Object>());
          result.put("String_Node_Str",resultHeaders);
          result.put("String_Node_Str",text);
          return Promises.newResultPromise(Responses.newActionResponse(result));
        }
 catch (        Exception ex) {
          return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + text + "String_Node_Str"+ ex.getMessage(),ex));
        }
      }
    }
 catch (    java.io.IOException ex) {
      return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + content,ex));
    }
 finally {
      if (null != cr) {
        cr.release();
      }
    }
  }
 catch (  Exception e) {
    return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException(e));
  }
}

Fixed version (ground truth):
@Override public Promise<ActionResponse,ResourceException> actionInstance(Context context,ActionRequest request){
  try {
    logger.debug("String_Node_Str",request.getAction(),request);
    JsonValue content=request.getContent();
    if (content == null || !content.isMap() || content.asMap().isEmpty()) {
      return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + request.getResourcePath() + "String_Node_Str"+ request.getAction()+ "String_Node_Str"));
    }
    String url=content.get(ARG_URL).required().asString();
    String method=content.get(ARG_METHOD).required().asString();
    JsonValue auth=content.get(ARG_AUTHENTICATE);
    Map<String,Object> headers=content.get(ARG_HEADERS).asMap();
    String contentType=content.get(ARG_CONTENT_TYPE).asString();
    String body=content.get(ARG_BODY).asString();
    boolean detectResultFormat=content.get(ARG_DETECT_RESULT_FORMAT).defaultTo(true).asBoolean();
    MediaType mediaType;
    if (contentType != null) {
      mediaType=new MediaType(contentType);
    }
 else {
      mediaType=MediaType.APPLICATION_JSON;
    }
    ClientResource cr=null;
    try {
      cr=new ClientResource(url);
      Map<String,Object> attrs=cr.getRequestAttributes();
      setAttributes(cr.getRequest(),attrs,headers);
      if (!auth.isNull()) {
        String type=auth.get("String_Node_Str").defaultTo("String_Node_Str").asString();
        if ("String_Node_Str".equalsIgnoreCase(type)) {
          String identifier=auth.get("String_Node_Str").required().asString();
          String secret=auth.get("String_Node_Str").required().asString();
          logger.debug("String_Node_Str",identifier,secret != null && secret.length() > 0);
          ChallengeResponse challengeResponse=new ChallengeResponse(ChallengeScheme.HTTP_BASIC,identifier,secret);
          cr.setChallengeResponse(challengeResponse);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(type)) {
          String token=auth.get("String_Node_Str").required().asString();
          logger.debug("String_Node_Str");
          Series<Header> extraHeaders=(Series<Header>)attrs.get("String_Node_Str");
          if (extraHeaders == null) {
            extraHeaders=new Series<Header>(Header.class);
          }
          extraHeaders.set("String_Node_Str","String_Node_Str" + token);
          attrs.put("String_Node_Str",extraHeaders);
        }
 else {
          return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + type + "String_Node_Str"+ request.getResourcePath()+ "String_Node_Str"+ request.getAction()));
        }
      }
      StringRepresentation rep=new StringRepresentation(body);
      rep.setMediaType(mediaType);
      Representation representation=null;
      try {
        if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.get();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.post(rep);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.put(rep);
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.delete();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.head();
        }
 else         if ("String_Node_Str".equalsIgnoreCase(method)) {
          representation=cr.options();
        }
 else {
          return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + method));
        }
      }
 catch (      org.restlet.resource.ResourceException e) {
        int code=e.getStatus().getCode();
        String text=null;
        Representation responseEntity=cr.getResponseEntity();
        if (responseEntity != null && !(responseEntity instanceof EmptyRepresentation)) {
          text=responseEntity.getText();
        }
        final ResourceException exception=ResourceException.getException(code,"String_Node_Str" + method + "String_Node_Str"+ e.getMessage(),e);
        if (text != null) {
          JsonValue detail=new JsonValue(new HashMap<String,Object>());
          detail.put("String_Node_Str",text);
          exception.setDetail(detail);
        }
        return Promises.newExceptionPromise(exception);
      }
      String text=representation.getText();
      logger.debug("String_Node_Str",text,cr.getResponseAttributes());
      if (detectResultFormat && representation.getMediaType().isCompatible(MediaType.APPLICATION_JSON)) {
        try {
          if (text != null && text.trim().length() > 0) {
            return Promises.newResultPromise(Responses.newActionResponse(JsonUtil.parseStringified(text)));
          }
 else {
            return Promises.newExceptionPromise(ResourceException.newBadRequestException("String_Node_Str" + url));
          }
        }
 catch (        Exception ex) {
          return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + text + "String_Node_Str"+ ex.getMessage(),ex));
        }
      }
 else {
        try {
          Map<String,Object> resultHeaders=new HashMap<String,Object>();
          Series<Header> respHeaders=(Series<Header>)cr.getResponseAttributes().get(HeaderConstants.ATTRIBUTE_HEADERS);
          if (respHeaders != null) {
            for (            Header param : respHeaders) {
              String name=param.getName();
              String value=param.getValue();
              resultHeaders.put(name,value);
              logger.debug("String_Node_Str",name,value);
            }
          }
          JsonValue result=new JsonValue(new HashMap<String,Object>());
          result.put("String_Node_Str",resultHeaders);
          result.put("String_Node_Str",text);
          return Promises.newResultPromise(Responses.newActionResponse(result));
        }
 catch (        Exception ex) {
          return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + text + "String_Node_Str"+ ex.getMessage(),ex));
        }
      }
    }
 catch (    java.io.IOException ex) {
      return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException("String_Node_Str" + content,ex));
    }
 finally {
      if (null != cr) {
        cr.release();
      }
    }
  }
 catch (  Exception e) {
    return Promises.newExceptionPromise(ResourceException.newInternalServerErrorException(e.getMessage(),e));
  }
}