Program: 79616
Project: 79616
Buggy source:
/** 
 * Returns the <code>AuthnRequest</code> from HttpServletRequest
 */
private static AuthnRequest getAuthnRequest(HttpServletRequest request,boolean isFromECP,String binding){
  if (isFromECP) {
    try {
      SOAPMessage msg=SOAPCommunicator.getInstance().getSOAPMessage(request);
      Element elem=SOAPCommunicator.getInstance().getSamlpElement(msg,SAML2Constants.AUTHNREQUEST);
      return ProtocolFactory.getInstance().createAuthnRequest(elem);
    }
 catch (    Exception ex) {
      SAML2Utils.debug.error("String_Node_Str",ex);
    }
    return null;
  }
 else {
    String samlRequest=request.getParameter(SAML2Constants.SAML_REQUEST);
    if (samlRequest == null) {
      SAML2Utils.debug.error("String_Node_Str");
      return null;
    }
    if (binding.equals(SAML2Constants.HTTP_REDIRECT)) {
      SAML2Utils.debug.message("String_Node_Str",samlRequest);
      return getAuthnRequest(samlRequest);
    }
 else     if (binding.equals(SAML2Constants.HTTP_POST)) {
      ByteArrayInputStream bis=null;
      AuthnRequest authnRequest=null;
      try {
        byte[] raw=Base64.decode(samlRequest);
        if (raw != null) {
          bis=new ByteArrayInputStream(raw);
          Document doc=XMLUtils.toDOMDocument(bis,SAML2Utils.debug);
          if (doc != null) {
            SAML2Utils.debug.message("String_Node_Str",XMLUtils.print(doc.getDocumentElement()));
            authnRequest=ProtocolFactory.getInstance().createAuthnRequest(doc.getDocumentElement());
          }
 else {
            SAML2Utils.debug.error("String_Node_Str" + samlRequest);
          }
        }
      }
 catch (      Exception ex) {
        SAML2Utils.debug.error("String_Node_Str",ex);
        return null;
      }
 finally {
        IOUtils.closeIfNotNull(bis);
      }
      return authnRequest;
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the <code>AuthnRequest</code> from HttpServletRequest
 */
private static AuthnRequest getAuthnRequest(HttpServletRequest request,boolean isFromECP,String binding){
  if (isFromECP) {
    try {
      SOAPMessage msg=SOAPCommunicator.getInstance().getSOAPMessage(request);
      Element elem=SOAPCommunicator.getInstance().getSamlpElement(msg,SAML2Constants.AUTHNREQUEST);
      return ProtocolFactory.getInstance().createAuthnRequest(elem);
    }
 catch (    Exception ex) {
      SAML2Utils.debug.error("String_Node_Str",ex);
    }
    return null;
  }
 else {
    String samlRequest=request.getParameter(SAML2Constants.SAML_REQUEST);
    if (samlRequest == null) {
      SAML2Utils.debug.error("String_Node_Str");
      return null;
    }
    if (binding.equals(SAML2Constants.HTTP_REDIRECT)) {
      SAML2Utils.debug.message("String_Node_Str",samlRequest);
      return getAuthnRequest(samlRequest);
    }
 else     if (binding.equals(SAML2Constants.HTTP_POST)) {
      ByteArrayInputStream bis=null;
      AuthnRequest authnRequest=null;
      try {
        byte[] raw=Base64.decode(samlRequest);
        if (raw != null) {
          bis=new ByteArrayInputStream(raw);
          Document doc=XMLUtils.toDOMDocument(bis,SAML2Utils.debug);
          if (doc != null) {
            SAML2Utils.debug.message("String_Node_Str" + "String_Node_Str",XMLUtils.print(doc.getDocumentElement()));
            authnRequest=ProtocolFactory.getInstance().createAuthnRequest(doc.getDocumentElement());
          }
 else {
            SAML2Utils.debug.error("String_Node_Str" + "String_Node_Str" + samlRequest);
          }
        }
      }
 catch (      Exception ex) {
        SAML2Utils.debug.error("String_Node_Str",ex);
        return null;
      }
 finally {
        IOUtils.closeIfNotNull(bis);
      }
      return authnRequest;
    }
    return null;
  }
}