Return-Path: Delivered-To: apmail-hc-commits-archive@www.apache.org Received: (qmail 96466 invoked from network); 2 Jul 2010 10:09:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Jul 2010 10:09:19 -0000 Received: (qmail 67925 invoked by uid 500); 2 Jul 2010 10:09:19 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 67888 invoked by uid 500); 2 Jul 2010 10:09:18 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 67881 invoked by uid 99); 2 Jul 2010 10:09:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 10:09:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 10:09:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0995423889ED; Fri, 2 Jul 2010 10:07:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r959933 - in /httpcomponents/httpcore/branches/4.0.x: ./ RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Date: Fri, 02 Jul 2010 10:07:51 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100702100752.0995423889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olegk Date: Fri Jul 2 10:07:51 2010 New Revision: 959933 URL: http://svn.apache.org/viewvc?rev=959933&view=rev Log: HTTPCORE-228: Fixed NPE in AsyncNHttpServiceHandler caused by entity enclosing requests if no matching request handler can be found Modified: httpcomponents/httpcore/branches/4.0.x/ (props changed) httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt httpcomponents/httpcore/branches/4.0.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Propchange: httpcomponents/httpcore/branches/4.0.x/ ------------------------------------------------------------------------------ svn:mergeinfo = /httpcomponents/httpcore/trunk:959930-959931 Modified: httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt?rev=959933&r1=959932&r2=959933&view=diff ============================================================================== --- httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt (original) +++ httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt Fri Jul 2 10:07:51 2010 @@ -1,5 +1,9 @@ Changes since 4.0.1 +* [HTTPCORE-228] Fixed NPE in AsyncNHttpServiceHandler caused by entity enclosing requests + if no matching request handler can be found. + Contributed by Oleg Kalnichevski + * [HTTPCORE-222] Fixed OSGi Import-Package Contributed by Willem Jiang Modified: httpcomponents/httpcore/branches/4.0.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.0.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java?rev=959933&r1=959932&r2=959933&view=diff ============================================================================== --- httpcomponents/httpcore/branches/4.0.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java (original) +++ httpcomponents/httpcore/branches/4.0.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Fri Jul 2 10:07:51 2010 @@ -177,7 +177,8 @@ public class AsyncNHttpServiceHandler ex try { if (request instanceof HttpEntityEnclosingRequest) { - if (((HttpEntityEnclosingRequest) request).expectContinue()) { + HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) request; + if (entityRequest.expectContinue()) { response = this.responseFactory.newHttpResponse( ver, HttpStatus.SC_CONTINUE, context); response.setParams( @@ -207,20 +208,19 @@ public class AsyncNHttpServiceHandler ex } } // Request content is expected. - HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); + ConsumingNHttpEntity consumingEntity = null; // Lookup request handler for this request if (requestHandler != null) { - ConsumingNHttpEntity consumingEntity = requestHandler.entityRequest( - (HttpEntityEnclosingRequest) request, context); - if (consumingEntity == null) { - consumingEntity = new ConsumingNHttpEntityTemplate( - entity, - new SkipContentListener(this.allocator)); - } - ((HttpEntityEnclosingRequest) request).setEntity(consumingEntity); - connState.setConsumingEntity(consumingEntity); + consumingEntity = requestHandler.entityRequest(entityRequest, context); + } + if (consumingEntity == null) { + consumingEntity = new ConsumingNHttpEntityTemplate( + entityRequest.getEntity(), + new SkipContentListener(this.allocator)); } + entityRequest.setEntity(consumingEntity); + connState.setConsumingEntity(consumingEntity); } else { // No request content is expected.