Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-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 3ED4810F72 for ; Thu, 24 Oct 2013 12:34:35 +0000 (UTC) Received: (qmail 38263 invoked by uid 500); 24 Oct 2013 12:34:35 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 38041 invoked by uid 500); 24 Oct 2013 12:34:28 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 38017 invoked by uid 99); 24 Oct 2013 12:34:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Oct 2013 12:34:26 +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; Thu, 24 Oct 2013 12:34:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6596B2388AC8; Thu, 24 Oct 2013 12:34:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1535353 - in /felix/trunk/metatype/src: main/java/org/apache/felix/metatype/AD.java test/java/org/apache/felix/metatype/ADTest.java Date: Thu, 24 Oct 2013 12:34:05 -0000 To: commits@felix.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131024123405.6596B2388AC8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Thu Oct 24 12:34:04 2013 New Revision: 1535353 URL: http://svn.apache.org/r1535353 Log: FELIX-4289 : Spaces within values are removed for default values Modified: felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java felix/trunk/metatype/src/test/java/org/apache/felix/metatype/ADTest.java Modified: felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java URL: http://svn.apache.org/viewvc/felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java?rev=1535353&r1=1535352&r2=1535353&view=diff ============================================================================== --- felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java (original) +++ felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java Thu Oct 24 12:34:04 2013 @@ -354,10 +354,20 @@ public class AD extends OptionalAttribut int length = listString.length(); boolean escaped = false; - + int spaceCount = 0; + boolean start = true; for (int i = 0; i < length; i++) { char ch = listString.charAt(i); + final boolean isWhitespace = Character.isWhitespace(ch); + if ( start ) + { + if ( isWhitespace ) + { + continue; + } + start = false; + } if (ch == '\\') { if (!escaped) @@ -373,23 +383,33 @@ public class AD extends OptionalAttribut // unescaped comma, this is a string delimiter... strings.add(sb.toString()); sb.setLength(0); + start = true; + spaceCount = 0; continue; } - } - else if (ch == ' ') + } else if ( ch == ' ') { - // we should ignore spaces normally, unless they are escaped... - if (!escaped) + // space is only ignored at beginning and end but not if escaped + if (!escaped ) { + spaceCount++; continue; } } - else if (Character.isWhitespace(ch)) + else if (isWhitespace ) { // Other whitespaces are ignored... continue; } + if ( spaceCount > 0) + { + for(int m = 0; m