[jbossws-issues] [JBoss JIRA] (JBWS-4019) Multiple reads of SOAP message through the context

R Searls (JIRA) issues at jboss.org
Wed Mar 22 17:51:00 EDT 2017


    [ https://issues.jboss.org/browse/JBWS-4019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13382647#comment-13382647 ] 

R Searls commented on JBWS-4019:
--------------------------------

I did some investigative testing of this using jbossws-cxf:1.3.0.Final;
jdk1.8.0_72-b15 and tested against wildfly902.  I used testcase
  modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
  
I added the following code
      
{code:java}
private String rlsTest() {
          StringBuffer sb = new StringBuffer();
          sb.append("#TEST# ");
          try {
             Map<String, DataHandler> attachments = (Map<String, DataHandler>) context.getMessageContext().get(
                 MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
             //int i = attachments.size();
             DataHandler dh = (DataHandler) attachments
                 .values()
                 .iterator()
                 .next();
             MimeMultipart mmp =  new MimeMultipart(dh.getDataSource());
             MimeMultipart mmp2 =  new MimeMultipart(dh.getDataSource());
             sb.append("##1##" + mmp.toString() + "##2##" +mmp2.toString());
             return  sb.toString();
          }  catch (Exception e) {
             e.printStackTrace();
             sb.append(e.toString());
             return sb.toString();
          }
      }
{code}

to file
  modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java

I found that there was a java.lang.IndexOutOfBoundsException thrown on the next()
  method call in 
             
{code:java}
DataHandler dh = (DataHandler) attachments
                 .values()
                 .iterator()
                 .next();
{code}


The returned string is:
#TEST# java.lang.IndexOutOfBoundsException: Index: 0, Size: 0


When I preceeded the above stmt with stmt
            
{code:java}
int i = attachments.size();
{code}

the java.lang.IndexOutOfBoundsException never occurs and the code runs successfully.

The returned string is:
#TEST# ##1##javax.mail.internet.MimeMultipart at 20833b56##2##javax.mail.internet.MimeMultipart at 4b15aaba



I preformed a further test that isolates the issue with this code.

{code:java}

        java.util.Collection<DataHandler>  cmap =  attachments.values();
         sb.append("after Collection; ");
         java.util.Iterator<DataHandler> it = cmap.iterator();
         sb.append("after Iterator; ");
         DataHandler myDH = it.next();
         sb.append("after next; ");
{code}


returned string is:
#TEST# after Collection; after Iterator; java.lang.IndexOutOfBoundsException: Index: 0, Size: 0


> Multiple reads of SOAP message through the context
> --------------------------------------------------
>
>                 Key: JBWS-4019
>                 URL: https://issues.jboss.org/browse/JBWS-4019
>             Project: JBoss Web Services
>          Issue Type: Bug
>          Components: jbossws-cxf
>            Reporter: Alessio Soldano
>             Fix For: jbossws-cxf-5.2.0.Final
>
>
> See https://developer.jboss.org/message/961026#961026
> Question is if this is because of a CXF impl choice and if there's any actual requirement about this in JAX-WS spec. Also note there're attachments involved here, so the problem could only be related to that (and to streaming...)



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jbossws-issues mailing list