Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B352710DD6 for ; Fri, 9 Aug 2013 12:43:59 +0000 (UTC) Received: (qmail 31872 invoked by uid 500); 9 Aug 2013 12:43:59 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 31746 invoked by uid 500); 9 Aug 2013 12:43:55 -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 31734 invoked by uid 99); 9 Aug 2013 12:43:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Aug 2013 12:43:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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, 09 Aug 2013 12:43:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E092B2388906; Fri, 9 Aug 2013 12:43:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1512286 - in /cxf/branches/2.7.x-fixes: ./ api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Date: Fri, 09 Aug 2013 12:43:29 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130809124329.E092B2388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Fri Aug 9 12:43:29 2013 New Revision: 1512286 URL: http://svn.apache.org/r1512286 Log: Merged revisions 1511946 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1511946 | ay | 2013-08-08 20:53:11 +0200 (Thu, 08 Aug 2013) | 1 line [CXF-5191] StaxUtils readQName not accepting leading and trailing whitespcaes ........ Modified: cxf/branches/2.7.x-fixes/ (props changed) cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Propchange: cxf/branches/2.7.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.7.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1512286&r1=1512285&r2=1512286&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original) +++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Fri Aug 9 12:43:29 2013 @@ -1518,6 +1518,7 @@ public final class StaxUtils { if (value == null) { return null; } + value = value.trim(); int index = value.indexOf(":"); Modified: cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java?rev=1512286&r1=1512285&r2=1512286&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java (original) +++ cxf/branches/2.7.x-fixes/api/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Fri Aug 9 12:43:29 2013 @@ -334,4 +334,34 @@ public class StaxUtilsTest extends Asser assertEquals(in.toString(), out.toString()); } + + @Test + public void testQName() throws Exception { + StringBuilder in = new StringBuilder(); + in.append(""); + in.append("f:Bar"); + in.append(" f:Bar "); + in.append("x:Bar"); + in.append(""); + + XMLStreamReader reader = StaxUtils.createXMLStreamReader( + new ByteArrayInputStream(in.toString().getBytes())); + + QName qname = new QName("http://example.com/", "Bar"); + assertEquals(XMLStreamReader.START_ELEMENT, reader.next()); + assertEquals(XMLStreamReader.START_ELEMENT, reader.next()); + // first bar + assertEquals(qname, StaxUtils.readQName(reader)); + assertEquals(XMLStreamReader.START_ELEMENT, reader.next()); + // second bar + assertEquals(qname, StaxUtils.readQName(reader)); + assertEquals(XMLStreamReader.START_ELEMENT, reader.next()); + // third bar + try { + StaxUtils.readQName(reader); + fail("invalid qname in mapping"); + } catch (Exception e) { + // ignore + } + } }