Program: 32737
Project: 32737
Buggy source:
/** 
 * Executes the request
 * @param requestEntity the request
 * @return the response of the request
 * @throws ArangoException
 */
private HttpResponseEntity executeInternal(String baseUrl,HttpRequestEntity requestEntity) throws ArangoException, SocketException {
  String url=buildUrl(baseUrl,requestEntity);
  if (logger.isDebugEnabled()) {
    if (requestEntity.type == RequestType.POST || requestEntity.type == RequestType.PUT || requestEntity.type == RequestType.PATCH) {
      logger.debug("String_Node_Str",new Object[]{requestEntity.type,url,requestEntity.headers,requestEntity.bodyText});
    }
 else {
      logger.debug("String_Node_Str",new Object[]{requestEntity.type,url,requestEntity.headers});
    }
  }
  HttpRequestBase request=null;
switch (requestEntity.type) {
case GET:
    request=new HttpGet(url);
  break;
case POST:
HttpPost post=new HttpPost(url);
configureBodyParams(requestEntity,post);
request=post;
break;
case PUT:
HttpPut put=new HttpPut(url);
configureBodyParams(requestEntity,put);
request=put;
break;
case PATCH:
HttpPatch patch=new HttpPatch(url);
configureBodyParams(requestEntity,patch);
request=patch;
break;
case HEAD:
request=new HttpHead(url);
break;
case DELETE:
request=new HttpDelete(url);
break;
}
String userAgent="String_Node_Str";
request.setHeader("String_Node_Str",userAgent);
if (requestEntity.headers != null) {
for (Entry<String,Object> keyValue : requestEntity.headers.entrySet()) {
request.setHeader(keyValue.getKey(),keyValue.getValue().toString());
}
}
Credentials credentials=null;
if (requestEntity.username != null && requestEntity.password != null) {
credentials=new UsernamePasswordCredentials(requestEntity.username,requestEntity.password);
}
 else if (configure.getUser() != null && configure.getPassword() != null) {
credentials=new UsernamePasswordCredentials(configure.getUser(),configure.getPassword());
}
if (credentials != null) {
BasicScheme basicScheme=new BasicScheme();
try {
request.addHeader(basicScheme.authenticate(credentials,request,null));
}
 catch (AuthenticationException e) {
throw new ArangoException(e);
}
}
if (this.getHttpMode().equals(HttpMode.ASYNC)) {
request.addHeader("String_Node_Str","String_Node_Str");
}
 else if (this.getHttpMode().equals(HttpMode.FIREANDFORGET)) {
request.addHeader("String_Node_Str","String_Node_Str");
}
if (configure.isEnableCURLLogger()) {
CURLLogger.log(url,requestEntity,userAgent,credentials);
}
HttpResponse response=null;
if (preDefinedResponse != null) {
return preDefinedResponse;
}
try {
response=client.execute(request);
if (response == null) {
return null;
}
HttpResponseEntity responseEntity=new HttpResponseEntity();
StatusLine status=response.getStatusLine();
responseEntity.statusCode=status.getStatusCode();
responseEntity.statusPhrase=status.getReasonPhrase();
logger.debug("String_Node_Str",requestEntity.type,responseEntity.statusCode);
Header etagHeader=response.getLastHeader("String_Node_Str");
if (etagHeader != null) {
responseEntity.etag=Long.parseLong(etagHeader.getValue().replace("String_Node_Str","String_Node_Str"));
}
responseEntity.headers=new TreeMap<String,String>();
for (Header header : response.getAllHeaders()) {
responseEntity.headers.put(header.getName(),header.getValue());
}
HttpEntity entity=response.getEntity();
if (entity != null) {
Header contentType=entity.getContentType();
if (contentType != null) {
responseEntity.contentType=contentType.getValue();
if (responseEntity.isDumpResponse()) {
responseEntity.stream=entity.getContent();
logger.debug("String_Node_Str",requestEntity.type,contentType.getValue());
}
}
if (responseEntity.stream == null) {
responseEntity.text=IOUtils.toString(entity.getContent());
logger.debug("String_Node_Str",requestEntity.type,responseEntity.text);
}
}
if (this.getHttpMode().equals(HttpMode.ASYNC)) {
Map<String,String> map=responseEntity.getHeaders();
this.addJob(map.get("String_Node_Str"),this.getCurrentObject());
}
 else if (this.getHttpMode().equals(HttpMode.FIREANDFORGET)) {
return null;
}
return responseEntity;
}
 catch (SocketException ex) {
throw ex;
}
catch (ClientProtocolException e) {
throw new ArangoException(e);
}
catch (IOException e) {
throw new ArangoException(e);
}
}

Fixed version (ground truth):
/** 
 * Executes the request
 * @param requestEntity the request
 * @return the response of the request
 * @throws ArangoException
 */
private HttpResponseEntity executeInternal(String baseUrl,HttpRequestEntity requestEntity) throws ArangoException, SocketException {
  String url=buildUrl(baseUrl,requestEntity);
  if (logger.isDebugEnabled()) {
    if (requestEntity.type == RequestType.POST || requestEntity.type == RequestType.PUT || requestEntity.type == RequestType.PATCH) {
      logger.debug("String_Node_Str",new Object[]{requestEntity.type,url,requestEntity.headers,requestEntity.bodyText});
    }
 else {
      logger.debug("String_Node_Str",new Object[]{requestEntity.type,url,requestEntity.headers});
    }
  }
  HttpRequestBase request;
switch (requestEntity.type) {
case POST:
    HttpPost post=new HttpPost(url);
  configureBodyParams(requestEntity,post);
request=post;
break;
case PUT:
HttpPut put=new HttpPut(url);
configureBodyParams(requestEntity,put);
request=put;
break;
case PATCH:
HttpPatch patch=new HttpPatch(url);
configureBodyParams(requestEntity,patch);
request=patch;
break;
case HEAD:
request=new HttpHead(url);
break;
case DELETE:
request=new HttpDelete(url);
break;
case GET:
default :
request=new HttpGet(url);
break;
}
String userAgent="String_Node_Str";
request.setHeader("String_Node_Str",userAgent);
if (requestEntity.headers != null) {
for (Entry<String,Object> keyValue : requestEntity.headers.entrySet()) {
request.setHeader(keyValue.getKey(),keyValue.getValue().toString());
}
}
Credentials credentials=null;
if (requestEntity.username != null && requestEntity.password != null) {
credentials=new UsernamePasswordCredentials(requestEntity.username,requestEntity.password);
}
 else if (configure.getUser() != null && configure.getPassword() != null) {
credentials=new UsernamePasswordCredentials(configure.getUser(),configure.getPassword());
}
if (credentials != null) {
BasicScheme basicScheme=new BasicScheme();
try {
request.addHeader(basicScheme.authenticate(credentials,request,null));
}
 catch (AuthenticationException e) {
throw new ArangoException(e);
}
}
if (this.getHttpMode().equals(HttpMode.ASYNC)) {
request.addHeader("String_Node_Str","String_Node_Str");
}
 else if (this.getHttpMode().equals(HttpMode.FIREANDFORGET)) {
request.addHeader("String_Node_Str","String_Node_Str");
}
if (configure.isEnableCURLLogger()) {
CURLLogger.log(url,requestEntity,userAgent,credentials);
}
HttpResponse response;
if (preDefinedResponse != null) {
return preDefinedResponse;
}
try {
response=client.execute(request);
if (response == null) {
return null;
}
HttpResponseEntity responseEntity=new HttpResponseEntity();
StatusLine status=response.getStatusLine();
responseEntity.statusCode=status.getStatusCode();
responseEntity.statusPhrase=status.getReasonPhrase();
logger.debug("String_Node_Str",requestEntity.type,responseEntity.statusCode);
Header etagHeader=response.getLastHeader("String_Node_Str");
if (etagHeader != null) {
responseEntity.etag=Long.parseLong(etagHeader.getValue().replace("String_Node_Str","String_Node_Str"));
}
responseEntity.headers=new TreeMap<String,String>();
for (Header header : response.getAllHeaders()) {
responseEntity.headers.put(header.getName(),header.getValue());
}
HttpEntity entity=response.getEntity();
if (entity != null) {
Header contentType=entity.getContentType();
if (contentType != null) {
responseEntity.contentType=contentType.getValue();
if (responseEntity.isDumpResponse()) {
responseEntity.stream=entity.getContent();
logger.debug("String_Node_Str",requestEntity.type,contentType.getValue());
}
}
if (responseEntity.stream == null) {
responseEntity.text=IOUtils.toString(entity.getContent());
logger.debug("String_Node_Str",requestEntity.type,responseEntity.text);
}
}
if (this.getHttpMode().equals(HttpMode.ASYNC)) {
Map<String,String> map=responseEntity.getHeaders();
this.addJob(map.get("String_Node_Str"),this.getCurrentObject());
}
 else if (this.getHttpMode().equals(HttpMode.FIREANDFORGET)) {
return null;
}
return responseEntity;
}
 catch (SocketException ex) {
throw ex;
}
catch (ClientProtocolException e) {
throw new ArangoException(e);
}
catch (IOException e) {
throw new ArangoException(e);
}
}