Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CXF-8939] NullPointerException: Cannot invoke "java.util.List.size()" #1461

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

garydgregory
Copy link
Member

@garydgregory garydgregory commented Oct 4, 2023

[CXF-8939] java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "java.util.Map$Entry.getValue()" is null

https://issues.apache.org/jira/browse/CXF-8939

"java.util.List.size()" because the return value of
"java.util.Map$Entry.getValue()" is null
@@ -153,13 +153,14 @@ private Map<String, String> getHeaders(Message message) {
return result;
}
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
if (entry.getValue().size() == 1) {
Object value = entry.getValue().get(0);
List<Object> list = entry.getValue() != null ? entry.getValue() : Collections.emptyList();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garydgregory could you please share which protocol header has null value? thank you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reta
I've asked. Our internal ticket only has the following log snippet (redacted):

2023-10-02T15:40:07,050 [qtp1256142210-44] DEBUG: 127.0.0.1 - 127.0.0.1 [02/Oct/2023:03:40:07 +0200] "POST / HTTP/1.1" 200 - 
2023-10-02T15:40:07,050 [qtp1256142210-44] DEBUG: [Header 1] Date: Mon, 02 Oct 2023 13:40:07 GMT
2023-10-02T15:40:07,050 [qtp1256142210-44] DEBUG: [Header 2] Content-Type: application/json;charset=utf-8
2023-10-02T15:40:07,050 [qtp1256142210-44] DEBUG: ... more headers will added later in the pipeline.
2023-10-02T15:40:07,269 [qtp1256142210-21] DEBUG: CXF SOAP Servlet [OurWSS4JInInterceptor] soapMsg: com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl@52a09527, functionName: urn:redacted
Oct 02, 2023 3:40:07 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://soap.comm.server.appinterface.redacted.com/}RedactedWebServiceProviderService#{http://soap.comm.server.appinterface.redacted.com/}invoke has thrown exception, unwinding now
java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "java.util.Map$Entry.getValue()" is null
...<as posted in the CXF issue>...

@reta reta merged commit a6b0b5b into apache:3.6.x-fixes Oct 4, 2023
3 checks passed
reta pushed a commit that referenced this pull request Oct 4, 2023
"java.util.List.size()" because the return value of
"java.util.Map$Entry.getValue()" is null
reta pushed a commit that referenced this pull request Oct 4, 2023
"java.util.List.size()" because the return value of
"java.util.Map$Entry.getValue()" is null

(cherry picked from commit a6b0b5b)
@garydgregory garydgregory deleted the 3.6.2_CXF-8939_fix_NPE branch October 5, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants