Program: 64361
Project: 64361
Buggy source:
@SuppressWarnings({"String_Node_Str"}) public SOAPMessage invoke(SOAPMessage request){
  Map<String,DataHandler> attachments=null;
  if (mtomEnabled) {
    attachments=(Map<String,DataHandler>)mc.get(INBOUND_MESSAGE_ATTACHMENTS);
  }
  SOAPMessage response=null;
  boolean usesSOAP12=false;
  DBWSAdapter dbwsAdapter=(DBWSAdapter)xrService;
  SOAPEnvelope envelope=null;
  try {
    envelope=request.getSOAPPart().getEnvelope();
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
  String namespaceURI=envelope.getNamespaceURI();
  usesSOAP12=namespaceURI.equals(URI_NS_SOAP_1_2_ENVELOPE);
  SOAPElement body;
  try {
    body=getSOAPBodyElement(envelope);
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
  if (body == null) {
    SOAPFault soapFault=null;
    try {
      SOAPFactory soapFactory=null;
      if (usesSOAP12) {
        soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
      }
 else {
        soapFactory=SOAPFactory.newInstance();
      }
      QName clientQName=null;
      if (usesSOAP12) {
        clientQName=new QName(URI_NS_SOAP_1_2_ENVELOPE,"String_Node_Str");
      }
 else {
        clientQName=new QName(URI_NS_SOAP_1_1_ENVELOPE,"String_Node_Str");
      }
      soapFault=soapFactory.createFault("String_Node_Str",clientQName);
    }
 catch (    SOAPException se) {
    }
    throw new SOAPFaultException(soapFault);
  }
  XMLRoot xmlRoot=null;
  try {
    XMLContext xmlContext=dbwsAdapter.getXMLContext();
    XMLUnmarshaller unmarshaller=xmlContext.createUnmarshaller();
    if (attachments != null && attachments.size() > 0) {
      unmarshaller.setAttachmentUnmarshaller(new XMLAttachmentUnmarshaller(){
        Map<String,DataHandler> attachments;
        public XMLAttachmentUnmarshaller setAttachments(        Map<String,DataHandler> attachments){
          this.attachments=attachments;
          return this;
        }
        public boolean isXOPPackage(){
          return true;
        }
        public DataHandler getAttachmentAsDataHandler(        String id){
          String attachmentRefId=id;
          if (attachmentRefId.startsWith("String_Node_Str")) {
            attachmentRefId=attachmentRefId.substring(4);
          }
          return attachments.get(attachmentRefId);
        }
        public byte[] getAttachmentAsByteArray(        String id){
          ByteArrayOutputStream out=null;
          try {
            DataHandler dh=attachments.get(id);
            if (dh == null) {
              return null;
            }
            InputStream in=dh.getInputStream();
            out=new ByteArrayOutputStream(1024);
            byte[] buf=new byte[1024];
            int len;
            while ((len=in.read(buf)) > 0) {
              out.write(buf,0,len);
            }
          }
 catch (          IOException e) {
          }
          if (out != null) {
            return out.toByteArray();
          }
          return null;
        }
      }
.setAttachments(attachments));
      dbwsAdapter.setCurrentAttachmentUnmarshaller(unmarshaller.getAttachmentUnmarshaller());
    }
    xmlRoot=(XMLRoot)unmarshaller.unmarshal(body,Invocation.class);
  }
 catch (  Exception e) {
    SOAPFault soapFault=null;
    try {
      SOAPFactory soapFactory=null;
      if (usesSOAP12) {
        soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
      }
 else {
        soapFactory=SOAPFactory.newInstance();
      }
      QName clientQName=null;
      if (usesSOAP12) {
        clientQName=new QName(URI_NS_SOAP_1_2_ENVELOPE,"String_Node_Str");
      }
 else {
        clientQName=new QName(URI_NS_SOAP_1_1_ENVELOPE,"String_Node_Str");
      }
      Throwable e1=e;
      if (e.getCause() != null) {
        e1=e.getCause();
      }
      soapFault=soapFactory.createFault("String_Node_Str" + e1,clientQName);
    }
 catch (    SOAPException se) {
    }
    throw new SOAPFaultException(soapFault);
  }
  Invocation invocation=(Invocation)xmlRoot.getObject();
  invocation.setName(xmlRoot.getLocalName());
  Operation op=dbwsAdapter.getOperation(invocation.getName());
  org.eclipse.persistence.internal.oxm.schema.model.Element invocationElement=(org.eclipse.persistence.internal.oxm.schema.model.Element)dbwsAdapter.getExtendedSchema().getTopLevelElements().get(invocation.getName());
  String typeName=invocationElement.getType();
  int idx=typeName.indexOf(':');
  if (idx != -1) {
    typeName=typeName.substring(idx + 1);
  }
  ComplexType complexType=(ComplexType)dbwsAdapter.getExtendedSchema().getTopLevelComplexTypes().get(typeName);
  if (complexType.getSequence() != null) {
    for (Iterator i=complexType.getSequence().getOrderedElements().iterator(); i.hasNext(); ) {
      org.eclipse.persistence.internal.oxm.schema.model.Element e=(org.eclipse.persistence.internal.oxm.schema.model.Element)i.next();
      String argName=e.getName();
      Object argValue=invocation.getParameter(argName);
      String argType=e.getType();
      if (argType != null) {
        String argTypePrefix=null;
        String nameSpaceURI=null;
        idx=argType.indexOf(':');
        if (idx != -1) {
          argTypePrefix=argType.substring(0,idx);
          argType=argType.substring(idx + 1);
          nameSpaceURI=dbwsAdapter.getSchema().getNamespaceResolver().resolveNamespacePrefix(argTypePrefix);
        }
        QName argQName=argTypePrefix == null ? new QName(nameSpaceURI,argType) : new QName(nameSpaceURI,argType,argTypePrefix);
        Class<?> clz=SCHEMA_2_CLASS.get(argQName);
        if (clz != null) {
          argValue=((XMLConversionManager)dbwsAdapter.getOXSession().getDatasourcePlatform().getConversionManager()).convertObject(argValue,clz,argQName);
          invocation.setParameter(argName,argValue);
        }
      }
    }
  }
  Object result=null;
  try {
    result=op.invoke(dbwsAdapter,invocation);
    if (result instanceof ValueObject) {
      result=((ValueObject)result).value;
    }
    response=responseWriter.generateResponse(op,usesSOAP12,result);
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
catch (  Exception e) {
    try {
      response=responseWriter.generateResponse(op,usesSOAP12,e);
    }
 catch (    SOAPException soape1) {
      SOAPFault soapFault=null;
      try {
        SOAPFactory soapFactory=null;
        if (usesSOAP12) {
          soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
        }
 else {
          soapFactory=SOAPFactory.newInstance();
        }
        QName serverQName=null;
        if (usesSOAP12) {
          serverQName=new QName(URI_NS_SOAP_1_2_ENVELOPE,"String_Node_Str");
        }
 else {
          serverQName=new QName(URI_NS_SOAP_1_1_ENVELOPE,"String_Node_Str");
        }
        soapFault=soapFactory.createFault("String_Node_Str" + e.getMessage(),serverQName);
      }
 catch (      SOAPException soape2) {
      }
      throw new SOAPFaultException(soapFault);
    }
  }
  return response;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) public SOAPMessage invoke(SOAPMessage request){
  Map<String,DataHandler> attachments=null;
  if (mtomEnabled) {
    attachments=(Map<String,DataHandler>)mc.get(INBOUND_MESSAGE_ATTACHMENTS);
  }
  SOAPMessage response=null;
  boolean usesSOAP12=false;
  DBWSAdapter dbwsAdapter=(DBWSAdapter)xrService;
  SOAPEnvelope envelope=null;
  try {
    envelope=request.getSOAPPart().getEnvelope();
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
  String namespaceURI=envelope.getNamespaceURI();
  usesSOAP12=namespaceURI.equals(URI_NS_SOAP_1_2_ENVELOPE);
  SOAPElement body;
  try {
    body=getSOAPBodyElement(envelope);
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
  if (body == null) {
    SOAPFault soapFault=null;
    try {
      SOAPFactory soapFactory=null;
      if (usesSOAP12) {
        soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
      }
 else {
        soapFactory=SOAPFactory.newInstance();
      }
      QName faultCodeQName=null;
      if (usesSOAP12) {
        faultCodeQName=SENDER_QNAME;
      }
 else {
        faultCodeQName=CLIENT_QNAME;
      }
      soapFault=soapFactory.createFault("String_Node_Str",faultCodeQName);
    }
 catch (    SOAPException se) {
    }
    throw new SOAPFaultException(soapFault);
  }
  XMLRoot xmlRoot=null;
  try {
    XMLContext xmlContext=dbwsAdapter.getXMLContext();
    XMLUnmarshaller unmarshaller=xmlContext.createUnmarshaller();
    if (attachments != null && attachments.size() > 0) {
      unmarshaller.setAttachmentUnmarshaller(new XMLAttachmentUnmarshaller(){
        Map<String,DataHandler> attachments;
        public XMLAttachmentUnmarshaller setAttachments(        Map<String,DataHandler> attachments){
          this.attachments=attachments;
          return this;
        }
        public boolean isXOPPackage(){
          return true;
        }
        public DataHandler getAttachmentAsDataHandler(        String id){
          String attachmentRefId=id;
          if (attachmentRefId.startsWith("String_Node_Str")) {
            attachmentRefId=attachmentRefId.substring(4);
          }
          return attachments.get(attachmentRefId);
        }
        public byte[] getAttachmentAsByteArray(        String id){
          ByteArrayOutputStream out=null;
          try {
            DataHandler dh=attachments.get(id);
            if (dh == null) {
              return null;
            }
            InputStream in=dh.getInputStream();
            out=new ByteArrayOutputStream(1024);
            byte[] buf=new byte[1024];
            int len;
            while ((len=in.read(buf)) > 0) {
              out.write(buf,0,len);
            }
          }
 catch (          IOException e) {
          }
          if (out != null) {
            return out.toByteArray();
          }
          return null;
        }
      }
.setAttachments(attachments));
      dbwsAdapter.setCurrentAttachmentUnmarshaller(unmarshaller.getAttachmentUnmarshaller());
    }
    xmlRoot=(XMLRoot)unmarshaller.unmarshal(body,Invocation.class);
  }
 catch (  Exception e) {
    SOAPFault soapFault=null;
    try {
      SOAPFactory soapFactory=null;
      if (usesSOAP12) {
        soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
      }
 else {
        soapFactory=SOAPFactory.newInstance();
      }
      QName faultCodeQName=null;
      if (usesSOAP12) {
        faultCodeQName=SENDER_QNAME;
      }
 else {
        faultCodeQName=CLIENT_QNAME;
      }
      Throwable e1=e;
      if (e.getCause() != null) {
        e1=e.getCause();
      }
      soapFault=soapFactory.createFault("String_Node_Str" + e1,faultCodeQName);
    }
 catch (    SOAPException se) {
    }
    throw new SOAPFaultException(soapFault);
  }
  Invocation invocation=(Invocation)xmlRoot.getObject();
  invocation.setName(xmlRoot.getLocalName());
  Operation op=dbwsAdapter.getOperation(invocation.getName());
  org.eclipse.persistence.internal.oxm.schema.model.Element invocationElement=(org.eclipse.persistence.internal.oxm.schema.model.Element)dbwsAdapter.getExtendedSchema().getTopLevelElements().get(invocation.getName());
  String typeName=invocationElement.getType();
  int idx=typeName.indexOf(':');
  if (idx != -1) {
    typeName=typeName.substring(idx + 1);
  }
  ComplexType complexType=(ComplexType)dbwsAdapter.getExtendedSchema().getTopLevelComplexTypes().get(typeName);
  if (complexType.getSequence() != null) {
    for (Iterator i=complexType.getSequence().getOrderedElements().iterator(); i.hasNext(); ) {
      org.eclipse.persistence.internal.oxm.schema.model.Element e=(org.eclipse.persistence.internal.oxm.schema.model.Element)i.next();
      String argName=e.getName();
      Object argValue=invocation.getParameter(argName);
      String argType=e.getType();
      if (argType != null) {
        String argTypePrefix=null;
        String nameSpaceURI=null;
        idx=argType.indexOf(':');
        if (idx != -1) {
          argTypePrefix=argType.substring(0,idx);
          argType=argType.substring(idx + 1);
          nameSpaceURI=dbwsAdapter.getSchema().getNamespaceResolver().resolveNamespacePrefix(argTypePrefix);
        }
        QName argQName=argTypePrefix == null ? new QName(nameSpaceURI,argType) : new QName(nameSpaceURI,argType,argTypePrefix);
        Class<?> clz=SCHEMA_2_CLASS.get(argQName);
        if (clz != null) {
          argValue=((XMLConversionManager)dbwsAdapter.getOXSession().getDatasourcePlatform().getConversionManager()).convertObject(argValue,clz,argQName);
          invocation.setParameter(argName,argValue);
        }
      }
    }
  }
  Object result=null;
  try {
    result=op.invoke(dbwsAdapter,invocation);
    if (result instanceof ValueObject) {
      result=((ValueObject)result).value;
    }
    response=responseWriter.generateResponse(op,usesSOAP12,result);
  }
 catch (  SOAPException se) {
    throw new WebServiceException(se.getMessage(),se);
  }
catch (  Exception e) {
    try {
      response=responseWriter.generateResponse(op,usesSOAP12,e);
    }
 catch (    SOAPException soape1) {
      SOAPFault soapFault=null;
      try {
        SOAPFactory soapFactory=null;
        if (usesSOAP12) {
          soapFactory=SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
        }
 else {
          soapFactory=SOAPFactory.newInstance();
        }
        QName faultCodeQName=null;
        if (usesSOAP12) {
          faultCodeQName=RECEIVER_QNAME;
        }
 else {
          faultCodeQName=SERVER_QNAME;
        }
        soapFault=soapFactory.createFault("String_Node_Str" + e.getMessage(),faultCodeQName);
      }
 catch (      SOAPException soape2) {
      }
      throw new SOAPFaultException(soapFault);
    }
  }
  return response;
}