Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 60627 invoked from network); 3 Aug 2009 19:13:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Aug 2009 19:13:46 -0000 Received: (qmail 23678 invoked by uid 500); 3 Aug 2009 19:13:51 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 23611 invoked by uid 500); 3 Aug 2009 19:13:51 -0000 Mailing-List: contact commits-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 commits@cxf.apache.org Received: (qmail 23602 invoked by uid 99); 3 Aug 2009 19:13:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 19:13:51 +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; Mon, 03 Aug 2009 19:13:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A7BD523888ED; Mon, 3 Aug 2009 19:13:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r800498 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Date: Mon, 03 Aug 2009 19:13:27 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090803191327.A7BD523888ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Mon Aug 3 19:13:27 2009 New Revision: 800498 URL: http://svn.apache.org/viewvc?rev=800498&view=rev Log: [CXF-2374] Handle possible number format exception when reading primitive param. Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=800498&r1=800497&r2=800498&view=diff ============================================================================== --- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original) +++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Mon Aug 3 19:13:27 2009 @@ -263,7 +263,18 @@ } if (pClass.isPrimitive()) { - return PrimitiveUtils.read(value, pClass); + try { + return PrimitiveUtils.read(value, pClass); + } catch (NumberFormatException nfe) { + // + // For a path parameter this is probably a 404, + // for others a 400... + // + if (pType == ParameterType.PATH) { + throw new WebApplicationException(nfe, Response.Status.NOT_FOUND); + } + throw new WebApplicationException(nfe, Response.Status.BAD_REQUEST); + } } // check constructors accepting a single String value try {