You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2009/04/03 23:04:12 UTC

[jira] Resolved: (CXF-2149) java.lang.ArrayStoreException getting headers in handler

     [ https://issues.apache.org/jira/browse/CXF-2149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2149.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.1
                   2.1.5
                   2.0.11

> java.lang.ArrayStoreException getting headers in handler
> --------------------------------------------------------
>
>                 Key: CXF-2149
>                 URL: https://issues.apache.org/jira/browse/CXF-2149
>             Project: CXF
>          Issue Type: Bug
>         Environment: JDK 1.6, Ubuntu Linux 8.10
>            Reporter: Jose Antonio
>            Assignee: Daniel Kulp
>             Fix For: 2.0.11, 2.1.5, 2.2.1
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.