Program: 51068
Project: 51068
Buggy source:
@Override public ClientResponse handle(final ClientRequest request) throws ClientHandlerException {
  boolean reqHadAuthHeaders=false;
  if (state.get().nextNonce != null) {
    reqHadAuthHeaders=true;
    String qopStr=null;
    if (state.get().qop != null) {
      qopStr=(state.get().qop == QOP.AUTH_INT) ? "String_Node_Str" : "String_Node_Str";
    }
    StringBuffer buff=new StringBuffer();
    buff.append("String_Node_Str");
    addKeyVal(buff,"String_Node_Str",this.user);
    addKeyVal(buff,"String_Node_Str",state.get().realm);
    addKeyVal(buff,"String_Node_Str",state.get().nextNonce);
    if (state.get().opaque != null) {
      addKeyVal(buff,"String_Node_Str",state.get().opaque);
    }
    if (state.get().algorithm != null) {
      addKeyVal(buff,"String_Node_Str",state.get().algorithm,false);
    }
    if (state.get().qop != null) {
      addKeyVal(buff,"String_Node_Str",qopStr,false);
    }
    String HA1=md5ForJoined(this.user.getBytes(CHARACTER_SET),state.get().realm.getBytes(CHARACTER_SET),this.password);
    String uri=request.getURI().getPath();
    addKeyVal(buff,"String_Node_Str",uri);
    String HA2;
    if (state.get().qop == QOP.AUTH_INT && (request.getEntity() != null)) {
      HA2=md5ForJoined(request.getMethod(),uri,request.getEntity().toString());
    }
 else {
      HA2=md5ForJoined(request.getMethod(),uri);
    }
    String response;
    if (state.get().qop == null) {
      response=md5ForJoined(HA1,state.get().nextNonce,HA2);
    }
 else {
      String cnonce=randHexBytes(CNONCE_NB_BYTES);
      String nc=String.format("String_Node_Str",state.get().counter);
      state.get().counter+=1;
      addKeyVal(buff,"String_Node_Str",cnonce);
      addKeyVal(buff,"String_Node_Str",nc,false);
      response=md5ForJoined(HA1,state.get().nextNonce,nc,cnonce,qopStr,HA2);
    }
    addKeyVal(buff,"String_Node_Str",response);
    buff.deleteCharAt(buff.length() - 1);
    String authLine=buff.toString();
    request.getHeaders().add(HttpHeaders.AUTHORIZATION,authLine);
  }
  ClientResponse response=getNext().handle(request);
  if (response.getClientResponseStatus() == Status.UNAUTHORIZED) {
    HashMap<String,String> map=parseHeaders(response.getHeaders().get(HttpHeaders.WWW_AUTHENTICATE));
    if (map == null) {
      return response;
    }
    state.get().realm=map.get("String_Node_Str");
    state.get().nextNonce=map.get("String_Node_Str");
    state.get().opaque=map.get("String_Node_Str");
    state.get().algorithm=map.get("String_Node_Str");
    state.get().domain=map.get("String_Node_Str");
    String qop=map.get("String_Node_Str");
    if (qop == null) {
      state.get().qop=null;
    }
 else {
      if (qop.contains("String_Node_Str")) {
        state.get().qop=QOP.AUTH_INT;
      }
 else       if (qop.contains("String_Node_Str")) {
        state.get().qop=QOP.AUTH;
      }
 else {
        state.get().qop=null;
      }
    }
    String staleStr=map.get("String_Node_Str");
    boolean stale=(staleStr != null) && staleStr.toLowerCase().equals("String_Node_Str");
    if (stale || !reqHadAuthHeaders) {
      return this.handle(request);
    }
 else {
      return response;
    }
  }
  return response;
}

Fixed version (ground truth):
@Override public ClientResponse handle(final ClientRequest request) throws ClientHandlerException {
  boolean reqHadAuthHeaders=false;
  if (state.get().nextNonce != null) {
    reqHadAuthHeaders=true;
    String qopStr=null;
    if (state.get().qop != null) {
      qopStr=(state.get().qop == QOP.AUTH_INT) ? "String_Node_Str" : "String_Node_Str";
    }
    StringBuffer buff=new StringBuffer();
    buff.append("String_Node_Str");
    addKeyVal(buff,"String_Node_Str",this.user);
    addKeyVal(buff,"String_Node_Str",state.get().realm);
    addKeyVal(buff,"String_Node_Str",state.get().nextNonce);
    if (state.get().opaque != null) {
      addKeyVal(buff,"String_Node_Str",state.get().opaque);
    }
    if (state.get().algorithm != null) {
      addKeyVal(buff,"String_Node_Str",state.get().algorithm,false);
    }
    if (state.get().qop != null) {
      addKeyVal(buff,"String_Node_Str",qopStr,false);
    }
    String HA1=md5ForJoined(this.user.getBytes(CHARACTER_SET),state.get().realm.getBytes(CHARACTER_SET),this.password);
    String uri=request.getURI().getRawPath();
    addKeyVal(buff,"String_Node_Str",uri);
    String HA2;
    if (state.get().qop == QOP.AUTH_INT && (request.getEntity() != null)) {
      HA2=md5ForJoined(request.getMethod(),uri,request.getEntity().toString());
    }
 else {
      HA2=md5ForJoined(request.getMethod(),uri);
    }
    String response;
    if (state.get().qop == null) {
      response=md5ForJoined(HA1,state.get().nextNonce,HA2);
    }
 else {
      String cnonce=randHexBytes(CNONCE_NB_BYTES);
      String nc=String.format("String_Node_Str",state.get().counter);
      state.get().counter+=1;
      addKeyVal(buff,"String_Node_Str",cnonce);
      addKeyVal(buff,"String_Node_Str",nc,false);
      response=md5ForJoined(HA1,state.get().nextNonce,nc,cnonce,qopStr,HA2);
    }
    addKeyVal(buff,"String_Node_Str",response);
    buff.deleteCharAt(buff.length() - 1);
    String authLine=buff.toString();
    request.getHeaders().add(HttpHeaders.AUTHORIZATION,authLine);
  }
  ClientResponse response=getNext().handle(request);
  if (response.getClientResponseStatus() == Status.UNAUTHORIZED) {
    HashMap<String,String> map=parseHeaders(response.getHeaders().get(HttpHeaders.WWW_AUTHENTICATE));
    if (map == null) {
      return response;
    }
    state.get().realm=map.get("String_Node_Str");
    state.get().nextNonce=map.get("String_Node_Str");
    state.get().opaque=map.get("String_Node_Str");
    state.get().algorithm=map.get("String_Node_Str");
    state.get().domain=map.get("String_Node_Str");
    String qop=map.get("String_Node_Str");
    if (qop == null) {
      state.get().qop=null;
    }
 else {
      if (qop.contains("String_Node_Str")) {
        state.get().qop=QOP.AUTH_INT;
      }
 else       if (qop.contains("String_Node_Str")) {
        state.get().qop=QOP.AUTH;
      }
 else {
        state.get().qop=null;
      }
    }
    String staleStr=map.get("String_Node_Str");
    boolean stale=(staleStr != null) && staleStr.toLowerCase().equals("String_Node_Str");
    if (stale || !reqHadAuthHeaders) {
      return this.handle(request);
    }
 else {
      return response;
    }
  }
  return response;
}