From dev-return-92160-apmail-geronimo-dev-archive=geronimo.apache.org@geronimo.apache.org Tue Aug 2 06:00:50 2011 Return-Path: X-Original-To: apmail-geronimo-dev-archive@www.apache.org Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6305F6040 for ; Tue, 2 Aug 2011 06:00:50 +0000 (UTC) Received: (qmail 72546 invoked by uid 500); 2 Aug 2011 06:00:46 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 72092 invoked by uid 500); 2 Aug 2011 06:00:35 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 72076 invoked by uid 99); 2 Aug 2011 06:00:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Aug 2011 06:00:33 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.136.44.55] (HELO smtp110.prem.mail.sp1.yahoo.com) (98.136.44.55) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 Aug 2011 06:00:25 +0000 Received: (qmail 63806 invoked from network); 2 Aug 2011 06:00:02 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=Z8QjFcX43x+1G57nT098rrMNgnyct3HwBc1AkjSDgBaInhutAepGG11uenmM9FKGo6lrO14C7+L3y8jPy5+yFMvFiKpEZ09KIFlu0DcslD2H6UgLY4Lh7RhAVwdO9tpqkgaWWSbzmnMZyXqXefj11hDNAqnOj9qeyNqnTiWqOyY= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1312264802; bh=LW1jHcd/5R7qp/luB4zfnkVsceTxdWa/4X8TVK7W+F0=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=zSnadetvM6C4AV+hH8nY6VXNU5GsskDd2Vh5VYwX3fB2590GRm623bG29I1+miNuONjMJA/agjLC0Ecj3FbYvhHY6yQQX+HhUw3zFNxwvcHCEpxbgAJYE0ltO5FUoX5qIrJ8YIbECGYTP5BleQB+loQNyfAKaFC4wbzeFXU4ADg= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Zj_QW5cVM1lXro.JV7sVEM8LN6PA4KcnN9XXzLxeMfnX41J q2QztAmFywD.m8GuD0AAY6Uz8CzwafHVG2dg.3rEx.0QUixGeJMskDoGu9_a BcDLHwEcYZvvenhiY.rsRM3Bt1BmFT9XJDH2NL1hH6yInboo.Lk85ol19jbV ZapoR8ylFwlRGj_oHRJatfaVr5oRcDgqm75jMq6vgFACy8Y8hVBMrommcasu 1paCTtyDHq_1fQ_i_ReFluEx8nMOCMqZKkFHTE16blwGcMR7G_V6GbFrgSk. 4J9KPcVQZWUZ8Tc6DP.3ksPHRcuXqdObQASBisvG4g5ZefIw9OM3HNA4tdQs qL3SFuTWgblKkTd9akGG4qg98QKtqRGPQ_BtVUDr5ZDJCgnJWx3lxM5.gfSd JSZ_e06o.IiQFmEMKBt4BxjtR9p9dPanMdyo- X-Yahoo-SMTP: .9oIUzyswBANsYgUm_5uPui0skTnzGJXJQ-- Received: from [10.0.1.4] (david_jencks@76.76.148.215 with plain) by smtp110.prem.mail.sp1.yahoo.com with SMTP; 01 Aug 2011 23:00:01 -0700 PDT Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: svn commit: r1153013 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java From: David Jencks In-Reply-To: Date: Mon, 1 Aug 2011 23:00:01 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20110802034002.BD3D923888BD@eris.apache.org> To: dev@geronimo.apache.org X-Mailer: Apple Mail (2.1084) X-Virus-Checked: Checked by ClamAV on apache.org I agree, this is a bad idea since the felix properties class is well = known and well tested. The usual way to use this class is to use the maven-bundle-plugin to = include it in your jar. I really don't recommend maintaining a copy in = geronimo unless we really need modifications. Any changes you want to = propose should be pushed back to the felix community. Please rewrite this using the felix properties class. thanks david jencks On Aug 1, 2011, at 9:32 PM, Jarek Gawor wrote: > I don't think I trust this processProperty() code. It doesn't seem to > support Unicode escaping for one. I would also strongly encourage > using the Properties class from the Felix util bundle (e.g. just pull > in the class into Geronimo and modify as necessary). >=20 > Jarek >=20 > On Mon, Aug 1, 2011 at 11:40 PM, wrote: >> Author: hanhongfang >> Date: Tue Aug 2 03:40:01 2011 >> New Revision: 1153013 >>=20 >> URL: http://svn.apache.org/viewvc?rev=3D1153013&view=3Drev >> Log: >> GERONIMO-5310 Better ordering for config-substitutions.properties >>=20 >> Modified: >> = geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/= apache/geronimo/system/configuration/LocalAttributeManager.java >>=20 >> Modified: = geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/= apache/geronimo/system/configuration/LocalAttributeManager.java >> URL: = http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geron= imo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAtt= ributeManager.java?rev=3D1153013&r1=3D1153012&r2=3D1153013&view=3Ddiff >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- = geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/= apache/geronimo/system/configuration/LocalAttributeManager.java = (original) >> +++ = geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/= apache/geronimo/system/configuration/LocalAttributeManager.java Tue Aug = 2 03:40:01 2011 >> @@ -24,10 +24,14 @@ import java.io.FileOutputStream; >> import java.io.FileReader; >> import java.io.FileWriter; >> import java.io.IOException; >> +import java.io.OutputStreamWriter; >> import java.io.Reader; >> import java.io.Writer; >> import java.util.ArrayList; >> import java.util.Collection; >> +import java.util.Collections; >> +import java.util.Comparator; >> +import java.util.Date; >> import java.util.HashMap; >> import java.util.Iterator; >> import java.util.List; >> @@ -672,10 +676,24 @@ public class LocalAttributeManager imple >> private static void storeConfigSubstitutions(File = configSubstitutionsFile, Properties properties) { >> if (configSubstitutionsFile !=3D null) { >> try { >> - FileOutputStream out =3D new = FileOutputStream(configSubstitutionsFile); >> + OutputStreamWriter out =3D new = OutputStreamWriter(new FileOutputStream(configSubstitutionsFile), >> + "ISO-8859-1"); >> try { >> - out.write(INSTRUCTION); >> - properties.store(out, null); >> + out.write(new String(INSTRUCTION)); >> + out.write("#" + (new Date()).toString() + "\n"); >> + >> + ArrayList keys2 =3D new = ArrayList(properties.keySet()); >> + Collections.sort(keys2, new Comparator() = { >> + public int compare(String o1, String o2) { >> + return = o1.toLowerCase().compareTo(o2.toLowerCase()); >> + } >> + }); >> + for (Object o : keys2) { >> + String key =3D (String) o; >> + String value =3D = properties.getProperty(key); >> + out.write(processProperty(key, true) + "=3D" = + processProperty(value, false) + "\n"); >> + } >> + out.flush(); >> } finally { >> out.close(); >> } >> @@ -685,6 +703,17 @@ public class LocalAttributeManager imple >> } >> } >>=20 >> + // process the value and element of property as what = java.util.Properties.store(Writer writer, String comments) does >> + private static String processProperty(String str, boolean isKey) = { >> + boolean hasLeadingSpace =3D str.startsWith(" "); >> + String temp0 =3D isKey ? str.replaceAll(" ", "\\\\ ") : = (hasLeadingSpace ? str.replaceFirst(" ", "\\\\ ") : str); >> + String temp1 =3D temp0.replaceAll("!", "\\\\!"); >> + String temp2 =3D temp1.replaceAll("#", "\\\\#"); >> + String temp3 =3D temp2.replaceAll(":", "\\\\:"); >> + String temp4 =3D temp3.replaceAll("=3D", "\\\\=3D"); >> + return temp4; >> + } >> + >> private static void addGeronimoSubstitutions(Map = vars, Map props, String prefix) { >> if (prefix !=3D null) { >> int start =3D prefix.length(); >>=20 >>=20 >>=20