Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2149

java.lang.ArrayStoreException getting headers in handler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.11, 2.1.5, 2.2.1
    • None
    • None
    • JDK 1.6, Ubuntu Linux 8.10

    Description

      When calling

      Object[] getHeaders(QName name, JAXBContext context, boolean allRoles)

      In a header, I get an ArrayStoreException. Looking at the code, I've found this at org.apache.cxf.jaxws.handler.soap.SOAPMessageContextImpl.getHeaders(SOAPMessageContextImpl.java:106):

      public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
      SOAPMessage msg = getMessage();
      SOAPHeader header;
      try {
      header = msg.getSOAPPart().getEnvelope().getHeader();
      if (header == null || !header.hasChildNodes())

      { return new Object[0]; }

      List<Object> ret = new ArrayList<Object>();
      Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements());
      while (it.hasNext()) {
      SOAPHeaderElement she = it.next();
      if ((allRoles

      roles.contains(she.getActor()))
      && name.equals(she.getElementQName())) { ret.add(context.createUnmarshaller().unmarshal(she)); }

      }
      return ret.toArray(new SOAPHeaderElement[ret.size()]);
      } catch (SOAPException e)

      { throw new WebServiceException(e); } catch (JAXBException e) { throw new WebServiceException(e); }


      }

      ret is a list of objects that gets populated with unmarshalled elements. In the return statement it tries to cast it to an array of SOAPHeaderElement, but the elements inside are not SOAPHeaderElement so it throws the aforementioned exception.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            getaceres Jose Antonio
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: