eclipse-ee4j / eclipse-ee4j/metro-wsit

CLONE - NullPointerException in PolicyUtil.java line 78

Open
#370 0 comments 0 reactions 0 assignees View on GitHub
ERR: Assignee gf4-exclude metro2_2-waived NullPointerException PolicyUtil Priority: Major spVersion Type: Bug
Dominant language
Java
Stars
6
Forks
21
Avg merge
10h 2m
Merged PRs (30d)
1

Description

On a websphere appserver i run a webservice which has the following policy defined:

```











```

The policy is referenced by the operation input.

```













```

If i run my metro 2.1/2.1.1 client i get the following exception:

```
Caused by: java.lang.NullPointerException
at com.sun.xml.ws.security.impl.policy.PolicyUtil.isSecurityPolicyNS(PolicyUtil.java:78)
at com.sun.xml.ws.security.impl.policy.PolicyUtil.isSignedParts(PolicyUtil.java:502)
at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.collectPolicies(XWSSPolicyGenerator.java:313)
at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:165)
at com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:160)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.constructPolicyHolder(SecurityTubeBase.java:1338)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.constructPolicyHolder(SecurityTubeBase.java:1331)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.addOutgoingMP(SecurityClientTube.java:701)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectOperationAndMessageLevelPolicies(SecurityTubeBase.java:824)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectPolicies(SecurityTubeBase.java:758)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.(SecurityTubeBase.java:274)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.(SecurityClientTube.java:152)
at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.createTube(SecurityTubeFactory.java:285)
at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:84)
at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClient(TubelineAssemblerFactoryImpl.java:130)
at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:228)
at com.sun.xml.ws.client.Stub.(Stub.java:205)
at com.sun.xml.ws.client.Stub.(Stub.java:178)
at com.sun.xml.ws.client.sei.SEIStub.(SEIStub.java:85)
at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:608)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:348)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
at javax.xml.ws.Service.getPort(Service.java:175)
```

After some debugging i found out that it is because the spVersion of the SecurityTubeBase class is never initialized.
If i append the policy to the binding it's working.

I think the problem is in the collectPolicies() method of the SecurityTubeBase class.
The method setPolicyCredentials(), which initializes the spVersion, is only called for endpoint and operation policies.
#### Environment
Server: IBM WebSphere Applicationserver 7

Client: JRE 1.6 u29 + Metro 2.1/2.1.1
#### Affected Versions
[2.1, 2.1.1]

Source: [https://github.com/javaee/metro-wsit/issues/1650](https://github.com/javaee/metro-wsit/issues/1650)
Author: glassfishrobot

Contributor guide

Open the contributing guide

Research direction

Inspect SecurityTubeBase.collectPolicies() and the setPolicyCredentials() calls that initialize spVersion, then trace the PolicyUtil.isSecurityPolicyNS() call in the stack trace. Reproduce the client failure with the policy attached only to the operation input, compare it with the binding-level policy case, and consider the issue done when the operation-level policy no longer causes a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.