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 5B2C110C3A for ; Thu, 13 Mar 2014 08:19:46 +0000 (UTC) Received: (qmail 14256 invoked by uid 500); 13 Mar 2014 08:19:45 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 14157 invoked by uid 500); 13 Mar 2014 08:19:43 -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 14150 invoked by uid 99); 13 Mar 2014 08:19:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 08:19:42 +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, 13 Mar 2014 08:19:40 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 544F72388906; Thu, 13 Mar 2014 08:19:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1577060 - /felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java Date: Thu, 13 Mar 2014 08:19:19 -0000 To: commits@felix.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140313081919.544F72388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Thu Mar 13 08:19:18 2014 New Revision: 1577060 URL: http://svn.apache.org/r1577060 Log: [FELIX-4457]org.apache.felix.utils.properties will save key=value on top of comments if the original properties file are all comments Modified: felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java Modified: felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java?rev=1577060&r1=1577059&r2=1577060&view=diff ============================================================================== --- felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java (original) +++ felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java Thu Mar 13 08:19:18 2014 @@ -350,8 +350,10 @@ public class Properties extends Abstract protected void loadLayout(Reader in) throws IOException { PropertiesReader reader = new PropertiesReader(in); + boolean hasProperty = false; while (reader.nextProperty()) { + hasProperty = true; storage.put(reader.getPropertyName(), reader.getPropertyValue()); int idx = checkHeaderComment(reader.getCommentLines()); layout.put(reader.getPropertyName(), @@ -360,7 +362,11 @@ public class Properties extends Abstract null, new ArrayList(reader.getValueLines()))); } - footer = new ArrayList(reader.getCommentLines()); + if (hasProperty) { + footer = new ArrayList(reader.getCommentLines()); + } else { + header = new ArrayList(reader.getCommentLines()); + } if (substitute) { substitute(); @@ -1099,4 +1105,4 @@ public class Properties extends Abstract } // class Layout -} \ No newline at end of file +}