Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 949B217600 for ; Mon, 18 May 2015 17:59:00 +0000 (UTC) Received: (qmail 89723 invoked by uid 500); 18 May 2015 17:59:00 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 89697 invoked by uid 500); 18 May 2015 17:59:00 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 89686 invoked by uid 99); 18 May 2015 17:59:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2015 17:59:00 +0000 Date: Mon, 18 May 2015 17:59:00 +0000 (UTC) From: "Dmitriy Fedoriv (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-6408) HTTP Conduit throws NPE exception for "invalid" 401 HTTP response MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-6408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dmitriy Fedoriv updated CXF-6408: --------------------------------- Description: Hi guys, In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate" header. In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception: 2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {}WebClient has thrown exception, unwinding now java.lang.NullPointerException: NullPointerException invoking : null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320) at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346) at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40) Caused by: java.lang.NullPointerException at org.apache.cxf.transport.http.auth.HttpAuthHeader.(HttpAuthHeader.java:52) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330) ... 11 more I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified". Thank you! was: Hi guys, In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate". In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception: 2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {}WebClient has thrown exception, unwinding now java.lang.NullPointerException: NullPointerException invoking : null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320) at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346) at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40) Caused by: java.lang.NullPointerException at org.apache.cxf.transport.http.auth.HttpAuthHeader.(HttpAuthHeader.java:52) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330) ... 11 more I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified". Thank you! > HTTP Conduit throws NPE exception for "invalid" 401 HTTP response > ----------------------------------------------------------------- > > Key: CXF-6408 > URL: https://issues.apache.org/jira/browse/CXF-6408 > Project: CXF > Issue Type: Bug > Components: JAX-RS, Transports > Affects Versions: 3.0.2, 3.1.0 > Environment: Windows 7, JDK1.7.0_65, cxf-rt-transports-http: 3.0.x > Reporter: Dmitriy Fedoriv > Priority: Minor > > Hi guys, > In process of using RESTful client based on Apache CXF JAX-RS with activated auto-redirect option, I observed NPE on my logs. The short investigation shows that the problem was caused by Web Service side, that send "401 Unauthorized" HTTP response without "WWW-Authenticate" header. > In this case, on HTTPConduit class when we try to handle retransmits (by auto-redirect option), we expect that response message MUST contains authentication params, but header map doesn't contain it. As a result we observe the following exception: > 2015-05-18 21:43:12,730 [WARN|org.apache.cxf.phase.PhaseInterceptorChain|LogUtils] Interceptor for {}WebClient has thrown exception, unwinding now > java.lang.NullPointerException: NullPointerException invoking : null > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) > at java.lang.reflect.Constructor.newInstance(Unknown Source) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1359) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348) > at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) > at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638) > at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) > at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) > at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:619) > at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1084) > at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883) > at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854) > at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:320) > at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:346) > at com.edifecs.etools.xeserver.restful.client.transport.impl.Test.main(Test.java:40) > Caused by: java.lang.NullPointerException > at org.apache.cxf.transport.http.auth.HttpAuthHeader.(HttpAuthHeader.java:52) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.authorizationRetransmit(HTTPConduit.java:1480) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.processRetransmit(HTTPConduit.java:1420) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1395) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1522) > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330) > ... 11 more > I understand that described case is invalid by server, but I think it will be cool if we log some more informative. For example: "Authentication parameters is not specified". > Thank you! -- This message was sent by Atlassian JIRA (v6.3.4#6332)