Program: 29079
Project: 29079
Buggy source:
private void handlePost(HttpServletRequest req,HttpServletResponse resp,EjbRuntimeEndpointInfo endpointInfo) throws IOException, SOAPException {
  JAXRPCEndpointImpl endpoint=null;
  String messageID=null;
  SOAPMessageContext msgContext=null;
  try {
    MimeHeaders headers=wsUtil.getHeaders(req);
    if (!wsUtil.hasTextXmlContentType(headers)) {
      wsUtil.writeInvalidContentType(resp);
      return;
    }
    msgContext=rpcFactory.createSOAPMessageContext();
    SOAPMessage message=createSOAPMessage(req,headers);
    boolean wssSucceded=true;
    if (message != null) {
      msgContext.setMessage(message);
      endpoint=(JAXRPCEndpointImpl)endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
      if (endpoint != null) {
        if (wsEngine.hasGlobalMessageListener()) {
          messageID=wsEngine.preProcessRequest(endpoint);
        }
      }
 else {
        logger.fine("String_Node_Str" + req.getRequestURI());
      }
      AdapterInvocationInfo aInfo=null;
      try {
        Ejb2RuntimeEndpointInfo endpointInfo2=(Ejb2RuntimeEndpointInfo)endpointInfo;
        aInfo=endpointInfo2.getHandlerImplementor();
        ((EJBInvocation)aInfo.getInv()).setMessageContext(msgContext);
        msgContext.setProperty(HTTP_SERVLET_RESPONSE,resp);
        if (secServ != null) {
          wssSucceded=secServ.validateRequest(endpointInfo2.getServerAuthConfig(),(StreamingHandler)aInfo.getHandler(),msgContext);
        }
        if (messageID != null || (endpoint != null && endpoint.hasListeners())) {
          ThreadLocalInfo threadLocalInfo=new ThreadLocalInfo(messageID,req);
          wsEngine.getThreadLocal().set(threadLocalInfo);
          endpoint.processRequest(msgContext);
        }
        if (wssSucceded) {
          aInfo.getHandler().handle(msgContext);
        }
      }
  finally {
        if (aInfo != null) {
          endpointInfo.releaseImplementor(aInfo.getInv());
        }
      }
    }
 else {
      String errorMsg="String_Node_Str" + endpointInfo.getEndpoint().getEndpointName() + "String_Node_Str"+ endpointInfo.getEndpointAddressUri();
      logger.fine(errorMsg);
      msgContext.writeSimpleErrorResponse(FAULT_CODE_CLIENT,errorMsg);
    }
    if (messageID != null || endpoint != null) {
      endpoint.processResponse(msgContext);
    }
    SOAPMessage reply=msgContext.getMessage();
    if (secServ != null && wssSucceded) {
      Ejb2RuntimeEndpointInfo endpointInfo2=(Ejb2RuntimeEndpointInfo)endpointInfo;
      secServ.secureResponse(endpointInfo2.getServerAuthConfig(),(StreamingHandler)endpointInfo2.getHandlerImplementor().getHandler(),msgContext);
    }
    if (reply.saveRequired()) {
      reply.saveChanges();
    }
    wsUtil.writeReply(resp,msgContext);
  }
 catch (  Throwable e) {
    String errorMessage="String_Node_Str" + endpointInfo.getEndpoint().getEndpointName() + "String_Node_Str"+ endpointInfo.getEndpointAddressUri();
    logger.log(Level.WARNING,errorMessage,e);
    SOAPMessageContext errorMsgContext=rpcFactory.createSOAPMessageContext();
    errorMsgContext.writeSimpleErrorResponse(SOAPConstants.FAULT_CODE_SERVER,errorMessage);
    resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    if (messageID != null || endpoint != null) {
      endpoint.processResponse(errorMsgContext);
    }
    wsUtil.writeReply(resp,errorMsgContext);
  }
  if (messageID != null) {
    HttpResponseInfoImpl response=new HttpResponseInfoImpl(resp);
    wsEngine.postProcessResponse(messageID,response);
  }
}

Fixed version (ground truth):
private void handlePost(HttpServletRequest req,HttpServletResponse resp,EjbRuntimeEndpointInfo endpointInfo) throws IOException, SOAPException {
  JAXRPCEndpointImpl endpoint=null;
  String messageID=null;
  SOAPMessageContext msgContext=null;
  try {
    MimeHeaders headers=wsUtil.getHeaders(req);
    if (!wsUtil.hasTextXmlContentType(headers)) {
      wsUtil.writeInvalidContentType(resp);
      return;
    }
    msgContext=rpcFactory.createSOAPMessageContext();
    SOAPMessage message=createSOAPMessage(req,headers);
    boolean wssSucceded=true;
    if (message != null) {
      msgContext.setMessage(message);
      endpoint=(JAXRPCEndpointImpl)endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
      if (endpoint != null) {
        if (wsEngine.hasGlobalMessageListener()) {
          messageID=wsEngine.preProcessRequest(endpoint);
        }
      }
 else {
        logger.fine("String_Node_Str" + req.getRequestURI());
      }
      AdapterInvocationInfo aInfo=null;
      if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
        throw new IllegalArgumentException(endpointInfo + "String_Node_Str");
      }
      try {
        Ejb2RuntimeEndpointInfo endpointInfo2=(Ejb2RuntimeEndpointInfo)endpointInfo;
        aInfo=endpointInfo2.getHandlerImplementor();
        ((EJBInvocation)aInfo.getInv()).setMessageContext(msgContext);
        msgContext.setProperty(HTTP_SERVLET_RESPONSE,resp);
        if (secServ != null) {
          wssSucceded=secServ.validateRequest(endpointInfo2.getServerAuthConfig(),(StreamingHandler)aInfo.getHandler(),msgContext);
        }
        if (messageID != null || (endpoint != null && endpoint.hasListeners())) {
          ThreadLocalInfo threadLocalInfo=new ThreadLocalInfo(messageID,req);
          wsEngine.getThreadLocal().set(threadLocalInfo);
          endpoint.processRequest(msgContext);
        }
        if (wssSucceded) {
          aInfo.getHandler().handle(msgContext);
        }
      }
  finally {
        if (aInfo != null) {
          endpointInfo.releaseImplementor(aInfo.getInv());
        }
      }
    }
 else {
      String errorMsg="String_Node_Str" + endpointInfo.getEndpoint().getEndpointName() + "String_Node_Str"+ endpointInfo.getEndpointAddressUri();
      logger.fine(errorMsg);
      msgContext.writeSimpleErrorResponse(FAULT_CODE_CLIENT,errorMsg);
    }
    if (messageID != null || endpoint != null) {
      endpoint.processResponse(msgContext);
    }
    SOAPMessage reply=msgContext.getMessage();
    if (secServ != null && wssSucceded) {
      if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
        throw new IllegalArgumentException(endpointInfo + "String_Node_Str");
      }
      Ejb2RuntimeEndpointInfo endpointInfo2=(Ejb2RuntimeEndpointInfo)endpointInfo;
      secServ.secureResponse(endpointInfo2.getServerAuthConfig(),(StreamingHandler)endpointInfo2.getHandlerImplementor().getHandler(),msgContext);
    }
    if (reply.saveRequired()) {
      reply.saveChanges();
    }
    wsUtil.writeReply(resp,msgContext);
  }
 catch (  Throwable e) {
    String errorMessage="String_Node_Str" + endpointInfo.getEndpoint().getEndpointName() + "String_Node_Str"+ endpointInfo.getEndpointAddressUri();
    logger.log(Level.WARNING,errorMessage,e);
    SOAPMessageContext errorMsgContext=rpcFactory.createSOAPMessageContext();
    errorMsgContext.writeSimpleErrorResponse(SOAPConstants.FAULT_CODE_SERVER,errorMessage);
    resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    if (messageID != null || endpoint != null) {
      endpoint.processResponse(errorMsgContext);
    }
    wsUtil.writeReply(resp,errorMsgContext);
  }
  if (messageID != null) {
    HttpResponseInfoImpl response=new HttpResponseInfoImpl(resp);
    wsEngine.postProcessResponse(messageID,response);
  }
}