Program: 51469
Project: 51469
Buggy source:
protected void marshallSoapMessage(HttpServletResponse response,byte[][] responseSoapParts) throws XmlaException {
  response.reset();
  response.setStatus(HttpServletResponse.SC_OK);
  try {
    OutputStream outputStream=response.getOutputStream();
    String encoding=(charEncoding != null) ? charEncoding : response.getCharacterEncoding();
    if (charEncoding != null) {
      response.setCharacterEncoding(charEncoding);
    }
    response.setContentType("String_Node_Str");
    byte[] soapHeader=responseSoapParts[0];
    byte[] soapBody=responseSoapParts[1];
    Object[] byteChunks=new Object[5];
    try {
      StringBuffer buf=new StringBuffer(500);
      buf.append("String_Node_Str");
      buf.append(encoding);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(NS_SOAP_ENV_1_1);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(NS_SOAP_ENC_1_1);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[0]=buf.toString().getBytes(encoding);
      byteChunks[1]=soapHeader;
      buf.setLength(0);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[2]=buf.toString().getBytes(encoding);
      byteChunks[3]=soapBody;
      buf.setLength(0);
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[4]=buf.toString().getBytes(encoding);
    }
 catch (    UnsupportedEncodingException uee) {
      LOGGER.warn("String_Node_Str",uee);
    }
    if (LOGGER.isDebugEnabled()) {
      StringBuffer buf=new StringBuffer(100);
      buf.append("String_Node_Str").append(nl);
      try {
        for (int i=0; i < byteChunks.length; i++) {
          byte[] chunk=(byte[])byteChunks[i];
          if (chunk != null && chunk.length > 0) {
            buf.append(new String(chunk,encoding));
          }
        }
      }
 catch (      UnsupportedEncodingException uee) {
        LOGGER.warn("String_Node_Str",uee);
      }
      LOGGER.debug(buf.toString());
    }
    if (LOGGER.isDebugEnabled()) {
      StringBuffer buf=new StringBuffer();
      buf.append("String_Node_Str").append(nl);
    }
    try {
      int bufferSize=4096;
      ByteBuffer buffer=ByteBuffer.allocate(bufferSize);
      WritableByteChannel wch=Channels.newChannel(outputStream);
      ReadableByteChannel rch=null;
      for (int i=0; i < byteChunks.length; i++) {
        if (byteChunks[i] == null || ((byte[])byteChunks[i]).length == 0)         continue;
        rch=Channels.newChannel(new ByteArrayInputStream((byte[])byteChunks[i]));
        int readSize=0;
        do {
          buffer.clear();
          readSize=rch.read(buffer);
          buffer.flip();
          int writeSize=0;
          while ((writeSize+=wch.write(buffer)) < readSize)           ;
        }
 while (readSize == bufferSize);
        rch.close();
      }
      outputStream.flush();
    }
 catch (    IOException ioe) {
      LOGGER.error("String_Node_Str",ioe);
    }
  }
 catch (  XmlaException xex) {
    throw xex;
  }
catch (  Exception ex) {
    throw new XmlaException(SERVER_FAULT_FC,MSM_UNKNOWN_CODE,MSM_UNKNOWN_FAULT_FS,ex);
  }
}

Fixed version (ground truth):
protected void marshallSoapMessage(HttpServletResponse response,byte[][] responseSoapParts) throws XmlaException {
  response.reset();
  response.setStatus(HttpServletResponse.SC_OK);
  try {
    String encoding=(charEncoding != null) ? charEncoding : response.getCharacterEncoding();
    if (charEncoding != null) {
      response.setCharacterEncoding(charEncoding);
    }
    response.setContentType("String_Node_Str");
    OutputStream outputStream=response.getOutputStream();
    byte[] soapHeader=responseSoapParts[0];
    byte[] soapBody=responseSoapParts[1];
    Object[] byteChunks=new Object[5];
    try {
      StringBuffer buf=new StringBuffer(500);
      buf.append("String_Node_Str");
      buf.append(encoding);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(NS_SOAP_ENV_1_1);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(NS_SOAP_ENC_1_1);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[0]=buf.toString().getBytes(encoding);
      byteChunks[1]=soapHeader;
      buf.setLength(0);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[2]=buf.toString().getBytes(encoding);
      byteChunks[3]=soapBody;
      buf.setLength(0);
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      buf.append("String_Node_Str");
      buf.append(SOAP_PREFIX);
      buf.append("String_Node_Str");
      buf.append(nl);
      byteChunks[4]=buf.toString().getBytes(encoding);
    }
 catch (    UnsupportedEncodingException uee) {
      LOGGER.warn("String_Node_Str",uee);
    }
    if (LOGGER.isDebugEnabled()) {
      StringBuffer buf=new StringBuffer(100);
      buf.append("String_Node_Str").append(nl);
      try {
        for (int i=0; i < byteChunks.length; i++) {
          byte[] chunk=(byte[])byteChunks[i];
          if (chunk != null && chunk.length > 0) {
            buf.append(new String(chunk,encoding));
          }
        }
      }
 catch (      UnsupportedEncodingException uee) {
        LOGGER.warn("String_Node_Str",uee);
      }
      LOGGER.debug(buf.toString());
    }
    if (LOGGER.isDebugEnabled()) {
      StringBuffer buf=new StringBuffer();
      buf.append("String_Node_Str").append(nl);
    }
    try {
      int bufferSize=4096;
      ByteBuffer buffer=ByteBuffer.allocate(bufferSize);
      WritableByteChannel wch=Channels.newChannel(outputStream);
      ReadableByteChannel rch=null;
      for (int i=0; i < byteChunks.length; i++) {
        if (byteChunks[i] == null || ((byte[])byteChunks[i]).length == 0)         continue;
        rch=Channels.newChannel(new ByteArrayInputStream((byte[])byteChunks[i]));
        int readSize=0;
        do {
          buffer.clear();
          readSize=rch.read(buffer);
          buffer.flip();
          int writeSize=0;
          while ((writeSize+=wch.write(buffer)) < readSize)           ;
        }
 while (readSize == bufferSize);
        rch.close();
      }
      outputStream.flush();
    }
 catch (    IOException ioe) {
      LOGGER.error("String_Node_Str",ioe);
    }
  }
 catch (  XmlaException xex) {
    throw xex;
  }
catch (  Exception ex) {
    throw new XmlaException(SERVER_FAULT_FC,MSM_UNKNOWN_CODE,MSM_UNKNOWN_FAULT_FS,ex);
  }
}