Alessio Soldano created CXF-4875:
------------------------------------

             Summary: NPE resolving policy reference
                 Key: CXF-4875
                 URL: https://issues.apache.org/jira/browse/CXF-4875
             Project: CXF
          Issue Type: Bug
          Components: WS-* Components
            Reporter: Alessio Soldano


This is related to the changes for CXF-4814 [1]. I get the following exception
{code}
java.lang.NullPointerException
        at 
org.apache.cxf.ws.policy.WSPolicyFeature.resolveLocal(WSPolicyFeature.java:236)
        at 
org.apache.cxf.ws.policy.WSPolicyFeature.resolveReference(WSPolicyFeature.java:225)
        at 
org.apache.cxf.ws.policy.WSPolicyFeature.initializeEndpointPolicy(WSPolicyFeature.java:153)
        at 
org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:118)
        at 
org.apache.cxf.frontend.ServerFactoryBean.applyFeatures(ServerFactoryBean.java:248)
        at 
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:192)
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:454)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
        ... 30 more
{code}

when dealing with a spring descriptor as follows:

{code}
...
<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
    <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";>
      <wsp:Policy/>
    </wsam:Addressing>
    <wsrmp:RMAssertion 
xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy";>
      <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
    </wsrmp:RMAssertion>
  </wsp:Policy>
  
  <jaxws:endpoint id='TestService' 
address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-rpc' 
implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicRPCEndpointImpl'>
    <jaxws:features>
      <p:policies>
        <wsp:PolicyReference URI="#RM" 
xmlns:wsp="http://www.w3.org/ns/ws-policy"/>
      </p:policies>
    </jaxws:features>
  </jaxws:endpoint>
...
{code}

It seems like the code in WSPolicyFeature::resolveLocal(PolicyReference ref, 
final Bus bus, DescriptionInfo i) is trying to access the current 
DescriptionInfo, while that will only be set later in 
WSPolicyFeature::initialize(Server server, Bus bus) (using the 
ServiceModelPolicyUpdater::addPolicyAttachments and 
ServiceModelPolicyUpdater::addPolicy methods)


[1] 
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?r1=1445307&r2=1445306&pathrev=1445307

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to