You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Scott Gray <sc...@hotwaxmedia.com> on 2012/05/16 03:17:21 UTC

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches.  Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method.  Obviously deprecation shouldn't be back-ported.

There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.

Regards
Scott

On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:

> Author: jleroux
> Date: Tue May 15 19:11:13 2012
> New Revision: 1338836
> 
> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
> Log:
> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
> ------------------------------------------------------------------------
> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
> 
> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
> * Adds the xml:space attribute into the valueType complexType
> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
> 
> I got an issue when 1st trying to commit: 
> Commit failed (details follow):
> While preparing
> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
> Inconsistent line ending style
> 
> So I forced the EOLs to my locale platform value (Win XP)
> ------------------------------------------------------------------------
> 
> 
> Modified:
>    ofbiz/branches/release12.04/   (props changed)
>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> 
> Propchange: ofbiz/branches/release12.04/
> ------------------------------------------------------------------------------
>  Merged /ofbiz/trunk:r1338831
> 
> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
> @@ -29,4 +29,5 @@ under the License.
>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
> </catalog>
> 
> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
> @@ -42,6 +42,7 @@ under the License.
>         <xs:simpleContent>
>             <xs:extension base="xs:string">
>                 <xs:attribute ref="xml:lang"/>
> +                <xs:attribute ref="xml:space"/>
>             </xs:extension>
>         </xs:simpleContent>
>     </xs:complexType>
> 
> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
> @@ -158,20 +158,26 @@ public class UtilXml {
> 
>     // ----- TrAX Methods ----------------- //
> 
> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
> -     * XML document. This method is provided as an alternative to the
> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
> -     * @param encoding Optional encoding, defaults to UTF-8
> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
> -     * will be omitted from the output
> -     * @param indent If <code>true</code>, the output will be indented
> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
> -     * the number of spaces to indent. Default is 4.
> +    /**
> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
> +     * 
> +     * @param encoding
> +     *            Optional encoding, defaults to UTF-8
> +     * @param omitXmlDeclaration
> +     *            If <code>true</code> the xml declaration will be omitted from the output
> +     * @param indent
> +     *            If <code>true</code>, the output will be indented
> +     * @param indentAmount
> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
> +     * @param keepSpace
> +     *            If <code>true</code> spaces are preserved, else striped
>      * @return A <code>Transformer</code> instance
>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>      * @throws TransformerConfigurationException
>      */
> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
> +            throws TransformerConfigurationException {
>         StringBuilder sb = new StringBuilder();
>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
> @@ -189,7 +195,11 @@ public class UtilXml {
>             sb.append(indentAmount <= 0 ? 4 : indentAmount);
>             sb.append("\"");
>         }
> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
> +        if (keepSpace) {
> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
> +        } else {
> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
> +        }
>         sb.append("<xsl:template match=\"@*|node()\">\n");
>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
> @@ -212,21 +222,29 @@ public class UtilXml {
>         transformer.transform(source, result);
>     }
> 
> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
> -     * using JAXP TrAX.
> -     * @param node The <code>Node</code> to serialize
> -     * @param os The <code>OutputStream</code> to serialize to
> -     * @param encoding Optional encoding, defaults to UTF-8
> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
> -     * will be omitted from the output
> -     * @param indent If <code>true</code>, the output will be indented
> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
> -     * the number of spaces to indent. Default is 4.
> +    /**
> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
> +     * 
> +     * @param node
> +     *            The <code>Node</code> to serialize
> +     * @param os
> +     *            The <code>OutputStream</code> to serialize to
> +     * @param encoding
> +     *            Optional encoding, defaults to UTF-8
> +     * @param omitXmlDeclaration
> +     *            If <code>true</code> the xml declaration will be omitted from the output
> +     * @param keepSpace
> +     *            If <code>true</code> spaces are preserved, else striped
> +     * @param indent
> +     *            If <code>true</code>, the output will be indented
> +     * @param indentAmount
> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>      * @throws TransformerException
>      */
> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
> +            boolean keepSpace) throws TransformerException {
> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>         transformDomDocument(transformer, node, os);
>     }
> 
> @@ -325,9 +343,9 @@ public class UtilXml {
>             return;
>         }
>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
> -        // charset = UTF-8, line width = 72
> +        // charset = UTF-8, line width = 72, strip spaces
>         try {
> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>         } catch (TransformerException e) {
>             // Wrapping this exception for backwards compatibility
>             throw new IOException(e.getMessage());
> 
> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
> @@ -8,6 +8,7 @@
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
> +
>     http://www.apache.org/licenses/LICENSE-2.0
> 
>     Unless required by applicable law or agreed to in writing,
> @@ -17,13 +18,13 @@
>     specific language governing permissions and limitations
>     under the License.
> -->
> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>     <property key="AP">
>         <value xml:lang="de">Kreditoren</value>
>         <value xml:lang="en">AP</value>
>         <value xml:lang="es">Compras</value>
>         <value xml:lang="fr">Cpt. fourn.</value>
> -        <value xml:lang="hi_IN">लेखा देय</value>
> +        <value xml:lang="hi-IN">लेखा देय</value>
>         <value xml:lang="it">AP</value>
>         <value xml:lang="nl">Schulden</value>
>         <value xml:lang="pt_BR">Contas a pagar</value>
> @@ -127,6 +128,7 @@
>     <property key="CommonAbort">
>         <value xml:lang="en">Abort</value>
>         <value xml:lang="es">Cancelar</value>
> +        <value xml:lang="fr">Abandonner</value>
>         <value xml:lang="vi">Hủy</value>
>     </property>
>     <property key="CommonAccepted">
> @@ -413,6 +415,7 @@
>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>         <value xml:lang="en">Address not found.</value>
>         <value xml:lang="es">Dirección no encontrada.</value>
> +        <value xml:lang="fr">Adresse inconnue</value>
>         <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>     </property>
>     <property key="CommonAddresses">
> @@ -2770,7 +2773,8 @@
>         <value xml:lang="zh_TW">電子郵件</value>
>     </property>
>     <property key="CommonEmptyHeader">
> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
> +        <!-- do not  remove this! -->
> +        <value xml:lang="en" xml:space="preserve"> </value>
>     </property>
>     <property key="CommonEnable">
>         <value xml:lang="en">Enable</value>
> @@ -11081,6 +11085,31 @@
>         <value xml:lang="zh">有效日期</value>
>         <value xml:lang="zh_TW">有效日</value>
>     </property>
> +    <property key="FormFieldTitle_expireButton">
> +        <value xml:lang="ar">نهاية الصلاحية</value>
> +        <value xml:lang="cs">Vypršet</value>
> +        <value xml:lang="de">Ablaufen</value>
> +        <value xml:lang="en">Expire</value>
> +        <value xml:lang="es">Expiración</value>
> +        <value xml:lang="fr">Invalider</value>
> +        <value xml:lang="hi-IN">निश्वासन</value>
> +        <value xml:lang="it">Scade</value>
> +        <value xml:lang="nl">Maak verlopen</value>
> +        <value xml:lang="pt">Expirar</value>
> +        <value xml:lang="pt-PT">Terminar</value>
> +        <value xml:lang="ro">Expira</value>
> +        <value xml:lang="ru">Прекратить</value>
> +        <value xml:lang="th">หมดเขต</value>
> +        <value xml:lang="vi">Hết hạn</value>
> +        <value xml:lang="zh">过期</value>
> +        <value xml:lang="zh-CN">过期</value>
> +        <value xml:lang="zh-TW">過期</value>
> +    </property>
> +    <property key="FormFieldTitle_extDevicePurposeActionId">
> +        <value xml:lang="en">External Device Purpose Action Id</value>
> +        <value xml:lang="es">Código acción dispositivo externo</value>
> +        <value xml:lang="fr">Obj. de l'action</value>
> +    </property>
>     <property key="FormFieldTitle_externalDeviceId">
>         <value xml:lang="en">External Device Id</value>
>         <value xml:lang="es">Código dispositivo externo</value>
> @@ -11091,11 +11120,6 @@
>         <value xml:lang="es">Código tipo dispositivo externo</value>
>         <value xml:lang="fr">Type de Mat. Externe</value>
>     </property>
> -    <property key="FormFieldTitle_extDevicePurposeActionId">
> -        <value xml:lang="en">External Device Purpose Action Id</value>
> -        <value xml:lang="es">Código acción dispositivo externo</value>
> -        <value xml:lang="fr">Obj. de l'action</value>
> -    </property>
>     <property key="FormFieldTitle_fromDate">
>         <value xml:lang="ar">تاريخ البدء</value>
>         <value xml:lang="de">Von Datum</value>
> 
> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
> import org.ofbiz.base.util.UtilValidate;
> import org.ofbiz.base.util.UtilXml;
> import org.ofbiz.base.util.cache.UtilCache;
> -
> import org.ofbiz.service.DispatchContext;
> import org.ofbiz.service.ServiceUtil;
> -
> import org.w3c.dom.Comment;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>                         if (apacheLicenseText != null) {
>                             fos.write(apacheLicenseText.getBytes());
>                         }
> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>                     } finally {
>                         fos.close();
>                         // clear cache to see immediately the new labels and
> 
> 


Re: CommonEmptyHeader

Posted by Jacques Le Roux <ja...@les7arts.com>.
OK, at revision: 1343016, I have replaced all remaining title="${uiLabelMap.CommonEmptyHeader}" by title=" ". I tested 
https://localhost:8443/ordermgr/control/OrderPurchaseReportOptions for OrderByReferrer form

In ListPartyCommEvents I replaced
<set field="toComplete"
value="${bsh:&quot;COM_ROLE_READ&quot;.equals(roleStatusId)?&quot;PartyToComplete&quot;:&quot;CommonEmptyHeader&quot;}"/>
by
<set field="toComplete" value="${groovy: 'COM_ROLE_READ'.equals(roleStatusId) ? 'PartyToComplete' : ' '}"/>

I tried to test but it's a real pain to create a communication event from 
https://localhost:8443/sfa/control/createCommunicationEvent. I always ended with  <<Column 'WORK_EFFORT_ID' cannot accept a NULL 
value.)>> (due to  <<Service ECA [createCommunicationEventWorkEff]>>)

I guess it's ok anyway, chapter closed

Jacques

From: "Paul Foxworthy" <pa...@cohsoft.com.au>
> Hi Jacques,
>
> If we reduce hundreds of uses to just a few, it's probably worthwhile. If
> there isn't a simple rule for what's left, I agree we can use title=" ".
>
> Cheers
>
> Paul Foxworthy
>
>
> Jacques Le Roux wrote
>>
>> What about the few other cases where it's not button for a hyperlink?
>> Maybe there a simple title="" is enough though, I did not try
>>
>> Of course I guess you noticed
>> http://svn.apache.org/viewvc?view=revision&revision=1340376
>> http://svn.apache.org/viewvc?view=revision&revision=1340374
>> Anyway still easy to change in a way or another by a S/R
>>
>> Jacques
>>
>> From: "Paul Foxworthy" &lt;paul@.com&gt;
>>> Hi Christian,
>>>
>>> I see your point.
>>>
>>> How about a rule that field won't display a prompt if its content is a
>>> single hyperlink, unless a title is explicitly defined? A little
>>> arbitrary,
>>> but easy to implement.
>>>
>>> Cheers
>>>
>>> Paul Foxworthy
>>>
>>>
>>> Christian Geisert wrote
>>>>
>>>> Paul Foxworthy schrieb:
>>>>> If the intention is to override the default behaviour, wouldn't it be
>>>>> clearer
>>>>> to add an attribute to the widget  along the lines of
>>>>>
>>>>> showTitle="false"
>>>>>
>>>>> or perhaps
>>>>>
>>>>> useFieldNameForTitle="false"
>>>>>
>>>>> instead of fighting with a fake title that's not really a title at all?
>>>>>
>>>>> The default value out of the schema for the attribute would, of course,
>>>>> be
>>>>> "true".
>>>>>
>>>>> What do people think?
>>>>
>>>> It's a little bit less hackish, but still a workaround ;-)
>>>>
>>>> Let's go another step back.
>>>>
>>>> In all the cases I had a closer look the field with CommonEmptyHeader
>>>> was an additional button (Cancel/Delete) to the default Submit button
>>>> (Create/Save etc.). I guess this is modeled after HTML.
>>>>
>>>> So I think the best thing would be to add a button as another field type
>>>> to Forms.
>>>>
>>>> Christian
>>>>
>>>
>>>
>>> -----
>>> --
>>> Coherent Software Australia Pty Ltd
>>> http://www.cohsoft.com.au/
>>>
>>> Bonsai ERP, the all-inclusive ERP system
>>> http://www.bonsaierp.com.au/
>>>
>>> --
>>> View this message in context:
>>> http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632477.html
>>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>>
>
>
> -----
> --
> Coherent Software Australia Pty Ltd
> http://www.cohsoft.com.au/
>
> Bonsai ERP, the all-inclusive ERP system
> http://www.bonsaierp.com.au/
>
> --
> View this message in context: 
> http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632484.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com. 

Re: CommonEmptyHeader

Posted by Paul Foxworthy <pa...@cohsoft.com.au>.
Hi Jacques,

If we reduce hundreds of uses to just a few, it's probably worthwhile. If
there isn't a simple rule for what's left, I agree we can use title=" ".

Cheers

Paul Foxworthy


Jacques Le Roux wrote
> 
> What about the few other cases where it's not button for a hyperlink?
> Maybe there a simple title="" is enough though, I did not try
> 
> Of course I guess you noticed
> http://svn.apache.org/viewvc?view=revision&revision=1340376
> http://svn.apache.org/viewvc?view=revision&revision=1340374
> Anyway still easy to change in a way or another by a S/R
> 
> Jacques
> 
> From: "Paul Foxworthy" &lt;paul@.com&gt;
>> Hi Christian,
>>
>> I see your point.
>>
>> How about a rule that field won't display a prompt if its content is a
>> single hyperlink, unless a title is explicitly defined? A little
>> arbitrary,
>> but easy to implement.
>>
>> Cheers
>>
>> Paul Foxworthy
>>
>>
>> Christian Geisert wrote
>>>
>>> Paul Foxworthy schrieb:
>>>> If the intention is to override the default behaviour, wouldn't it be
>>>> clearer
>>>> to add an attribute to the widget  along the lines of
>>>>
>>>> showTitle="false"
>>>>
>>>> or perhaps
>>>>
>>>> useFieldNameForTitle="false"
>>>>
>>>> instead of fighting with a fake title that's not really a title at all?
>>>>
>>>> The default value out of the schema for the attribute would, of course,
>>>> be
>>>> "true".
>>>>
>>>> What do people think?
>>>
>>> It's a little bit less hackish, but still a workaround ;-)
>>>
>>> Let's go another step back.
>>>
>>> In all the cases I had a closer look the field with CommonEmptyHeader
>>> was an additional button (Cancel/Delete) to the default Submit button
>>> (Create/Save etc.). I guess this is modeled after HTML.
>>>
>>> So I think the best thing would be to add a button as another field type
>>> to Forms.
>>>
>>> Christian
>>>
>>
>>
>> -----
>> --
>> Coherent Software Australia Pty Ltd
>> http://www.cohsoft.com.au/
>>
>> Bonsai ERP, the all-inclusive ERP system
>> http://www.bonsaierp.com.au/
>>
>> --
>> View this message in context: 
>> http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632477.html
>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
> 


-----
--
Coherent Software Australia Pty Ltd
http://www.cohsoft.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632484.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: CommonEmptyHeader

Posted by Jacques Le Roux <ja...@les7arts.com>.
What about the few other cases where it's not button for a hyperlink?
Maybe there a simple title="" is enough though, I did not try

Of course I guess you noticed
http://svn.apache.org/viewvc?view=revision&revision=1340376
http://svn.apache.org/viewvc?view=revision&revision=1340374
Anyway still easy to change in a way or another by a S/R

Jacques

From: "Paul Foxworthy" <pa...@cohsoft.com.au>
> Hi Christian,
>
> I see your point.
>
> How about a rule that field won't display a prompt if its content is a
> single hyperlink, unless a title is explicitly defined? A little arbitrary,
> but easy to implement.
>
> Cheers
>
> Paul Foxworthy
>
>
> Christian Geisert wrote
>>
>> Paul Foxworthy schrieb:
>>> If the intention is to override the default behaviour, wouldn't it be
>>> clearer
>>> to add an attribute to the widget  along the lines of
>>>
>>> showTitle="false"
>>>
>>> or perhaps
>>>
>>> useFieldNameForTitle="false"
>>>
>>> instead of fighting with a fake title that's not really a title at all?
>>>
>>> The default value out of the schema for the attribute would, of course,
>>> be
>>> "true".
>>>
>>> What do people think?
>>
>> It's a little bit less hackish, but still a workaround ;-)
>>
>> Let's go another step back.
>>
>> In all the cases I had a closer look the field with CommonEmptyHeader
>> was an additional button (Cancel/Delete) to the default Submit button
>> (Create/Save etc.). I guess this is modeled after HTML.
>>
>> So I think the best thing would be to add a button as another field type
>> to Forms.
>>
>> Christian
>>
>
>
> -----
> --
> Coherent Software Australia Pty Ltd
> http://www.cohsoft.com.au/
>
> Bonsai ERP, the all-inclusive ERP system
> http://www.bonsaierp.com.au/
>
> --
> View this message in context: 
> http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632477.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com. 

Re: CommonEmptyHeader

Posted by Paul Foxworthy <pa...@cohsoft.com.au>.
Hi Christian,

I see your point.

How about a rule that field won't display a prompt if its content is a
single hyperlink, unless a title is explicitly defined? A little arbitrary,
but easy to implement.

Cheers

Paul Foxworthy


Christian Geisert wrote
> 
> Paul Foxworthy schrieb:
>> If the intention is to override the default behaviour, wouldn't it be
>> clearer
>> to add an attribute to the widget  along the lines of
>> 
>> showTitle="false"
>> 
>> or perhaps
>> 
>> useFieldNameForTitle="false"
>> 
>> instead of fighting with a fake title that's not really a title at all?
>> 
>> The default value out of the schema for the attribute would, of course,
>> be
>> "true".
>> 
>> What do people think?
> 
> It's a little bit less hackish, but still a workaround ;-)
> 
> Let's go another step back.
> 
> In all the cases I had a closer look the field with CommonEmptyHeader
> was an additional button (Cancel/Delete) to the default Submit button
> (Create/Save etc.). I guess this is modeled after HTML.
> 
> So I think the best thing would be to add a button as another field type
> to Forms.
> 
> Christian
> 


-----
--
Coherent Software Australia Pty Ltd
http://www.cohsoft.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4632477.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: CommonEmptyHeader

Posted by Christian Geisert <ch...@isu-gmbh.de>.
Paul Foxworthy schrieb:
> If the intention is to override the default behaviour, wouldn't it be clearer
> to add an attribute to the widget  along the lines of
> 
> showTitle="false"
> 
> or perhaps
> 
> useFieldNameForTitle="false"
> 
> instead of fighting with a fake title that's not really a title at all?
> 
> The default value out of the schema for the attribute would, of course, be
> "true".
> 
> What do people think?

It's a little bit less hackish, but still a workaround ;-)

Let's go another step back.

In all the cases I had a closer look the field with CommonEmptyHeader
was an additional button (Cancel/Delete) to the default Submit button
(Create/Save etc.). I guess this is modeled after HTML.

So I think the best thing would be to add a button as another field type
to Forms.

Christian



Re: CommonEmptyHeader

Posted by Paul Foxworthy <pa...@cohsoft.com.au>.
If the intention is to override the default behaviour, wouldn't it be clearer
to add an attribute to the widget  along the lines of

showTitle="false"

or perhaps

useFieldNameForTitle="false"

instead of fighting with a fake title that's not really a title at all?

The default value out of the schema for the attribute would, of course, be
"true".

What do people think?

Cheers

Paul Foxworthy


Adrian Crum-3 wrote
> 
> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>> What's the point of CommonEmptyHeader?
>>
>> It's definied in CommonUiLabels.xml as:
>>
>> <property key="CommonEmptyHeader">
>>      
>>      <value xml:lang="en" xml:space="preserve">  </value>
>> </property>
>>
>> It is just a simple space (0x20)
>>
>> It is used ~500 times in forms as a title in a field definition
>>
>> Example:
>>
>> <form name="EditPerson" type="single" target="updatePerson"
>>    ...
>>    <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>
>>      <hyperlink target="${donePage}" also-hidden="false"
>>        description="${uiLabelMap.CommonCancelDone}">
>>        <parameter param-name="partyId"/>
>>      </hyperlink>
>>    </field>
>> </form>
>>
>>
>> This is a button which should have no label, but if the title attribute
>> is empty then the name attribute is used as label.
>>
>> Why not just put a space (" ") into the title attribute - still a hack,
>> but exactly same result a using CommonEmptyHeader without the need using
>> CommonEmptyHeader.
>>
>> The real solution is of course not to display a label if the title
>> attribute is empty.
> 
> An empty title attribute is meant to be a shortcut, or a developer's 
> convenience - the widgets will use the field name to look up the correct 
> label.
> 
> Putting a space in the title attribute is the only way to turn off the 
> default behavior.
> 
> -Adrian
> 


-----
--
Coherent Software Australia Pty Ltd
http://www.cohsoft.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1338836-in-ofbiz-branches-release12-04-framework-base-dtd-framework-base-src-org-ofbi-tp4631741p4631853.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: CommonEmptyHeader

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 16/05/2012, at 11:27 PM, Scott Gray wrote:

> On 16/05/2012, at 11:21 PM, Adrian Crum wrote:
> 
>> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>>> Adrian Crum schrieb:
>>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>>> What's the point of CommonEmptyHeader?
>>>>> 
>>>>> It's definied in CommonUiLabels.xml as:
>>>>> 
>>>>> <property key="CommonEmptyHeader">
>>>>>     <!-- do not  remove this! -->
>>>>>     <value xml:lang="en" xml:space="preserve">   </value>
>>>>> </property>
>>>>> 
>>>>> It is just a simple space (0x20)
>>>>> 
>>>>> It is used ~500 times in forms as a title in a field definition
>>>>> 
>>>>> Example:
>>>>> 
>>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>>   ...
>>>>>   <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>>> 
>>>>>     <hyperlink target="${donePage}" also-hidden="false"
>>>>>       description="${uiLabelMap.CommonCancelDone}">
>>>>>       <parameter param-name="partyId"/>
>>>>>     </hyperlink>
>>>>>   </field>
>>>>> </form>
>>>>> 
>>>>> 
>>>>> This is a button which should have no label, but if the title attribute
>>>>> is empty then the name attribute is used as label.
>>>>> 
>>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>>> but exactly same result a using CommonEmptyHeader without the need using
>>>>> CommonEmptyHeader.
>>>>> 
>>>>> The real solution is of course not to display a label if the title
>>>>> attribute is empty.
>>>> An empty title attribute is meant to be a shortcut, or a developer's
>>>> convenience - the widgets will use the field name to look up the correct
>>>> label.
>>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>> - IMHO it is bad for re-using labels...)
>>> 
>>>> Putting a space in the title attribute is the only way to turn off the
>>>> default behavior.
>>> Ok, so there is nothing against replacing
>>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>>> 
>> 
>> That is what we would like to do - but it doesn't work. That is what needs to be fixed.
>> 
>> -Adrian
> 
> Does element.hasAttribute really return false if an attribute exists with an empty value?  You'd think the javadoc would call that out since it defies common sense.
> 
> Regards
> Scott


If it does actually return true then we could just change this:
    if (UtilValidate.isNotEmpty(this.title)) return title.expandString(context);
to this:
    if (this.title != null) return title.expandString(context);




Re: CommonEmptyHeader

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 16/05/2012, at 11:21 PM, Adrian Crum wrote:

> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>> Adrian Crum schrieb:
>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>> What's the point of CommonEmptyHeader?
>>>> 
>>>> It's definied in CommonUiLabels.xml as:
>>>> 
>>>> <property key="CommonEmptyHeader">
>>>>      <!-- do not  remove this! -->
>>>>      <value xml:lang="en" xml:space="preserve">   </value>
>>>> </property>
>>>> 
>>>> It is just a simple space (0x20)
>>>> 
>>>> It is used ~500 times in forms as a title in a field definition
>>>> 
>>>> Example:
>>>> 
>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>    ...
>>>>    <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>> 
>>>>      <hyperlink target="${donePage}" also-hidden="false"
>>>>        description="${uiLabelMap.CommonCancelDone}">
>>>>        <parameter param-name="partyId"/>
>>>>      </hyperlink>
>>>>    </field>
>>>> </form>
>>>> 
>>>> 
>>>> This is a button which should have no label, but if the title attribute
>>>> is empty then the name attribute is used as label.
>>>> 
>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>> but exactly same result a using CommonEmptyHeader without the need using
>>>> CommonEmptyHeader.
>>>> 
>>>> The real solution is of course not to display a label if the title
>>>> attribute is empty.
>>> An empty title attribute is meant to be a shortcut, or a developer's
>>> convenience - the widgets will use the field name to look up the correct
>>> label.
>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>  - IMHO it is bad for re-using labels...)
>> 
>>> Putting a space in the title attribute is the only way to turn off the
>>> default behavior.
>> Ok, so there is nothing against replacing
>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>> 
> 
> That is what we would like to do - but it doesn't work. That is what needs to be fixed.
> 
> -Adrian

Does element.hasAttribute really return false if an attribute exists with an empty value?  You'd think the javadoc would call that out since it defies common sense.

Regards
Scott

Re: CommonEmptyHeader

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Christian Geisert" <ch...@isu-gmbh.de>
> Adrian Crum schrieb:
>> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>>> Adrian Crum schrieb:
>>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>>> What's the point of CommonEmptyHeader?
>>>>>
>>>>> It's definied in CommonUiLabels.xml as:
>>>>>
>>>>> <property key="CommonEmptyHeader">
>>>>>       <!-- do not  remove this! -->
>>>>>       <value xml:lang="en" xml:space="preserve">   </value>
>>>>> </property>
>>>>>
>>>>> It is just a simple space (0x20)
>>>>>
>>>>> It is used ~500 times in forms as a title in a field definition
>>>>>
>>>>> Example:
>>>>>
>>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>>     ...
>>>>>     <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>>>
>>>>>       <hyperlink target="${donePage}" also-hidden="false"
>>>>>         description="${uiLabelMap.CommonCancelDone}">
>>>>>         <parameter param-name="partyId"/>
>>>>>       </hyperlink>
>>>>>     </field>
>>>>> </form>
>>>>>
>>>>>
>>>>> This is a button which should have no label, but if the title attribute
>>>>> is empty then the name attribute is used as label.
>>>>>
>>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>>> but exactly same result a using CommonEmptyHeader without the need
>>>>> using
>>>>> CommonEmptyHeader.
>>>>>
>>>>> The real solution is of course not to display a label if the title
>>>>> attribute is empty.
>>>> An empty title attribute is meant to be a shortcut, or a developer's
>>>> convenience - the widgets will use the field name to look up the correct
>>>> label.
>>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>>   - IMHO it is bad for re-using labels...)
>>>
>>>> Putting a space in the title attribute is the only way to turn off the
>>>> default behavior.
>>> Ok, so there is nothing against replacing
>>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>>>
>>
>> That is what we would like to do - but it doesn't work. That is what
>> needs to be fixed.
>
> But if I do this in the above mentioned example (see attached patch) it
> seems to give the expected result (= no label). I'm a missing something?
>
> Christian


Maybe something has changed and this works without Scott's suggested change (if it works) now?
BTW I checked, I thought I was using CommonEmptyHeader in another way, than simply form title ,in a custom project, but I was wrong. 
So one of the solutions proposed is ok with me, the simpler the better

Jacques



--------------------------------------------------------------------------------


> Index: applications/party/widget/partymgr/PartyForms.xml
> ===================================================================
> --- applications/party/widget/partymgr/PartyForms.xml (Revision 1339064)
> +++ applications/party/widget/partymgr/PartyForms.xml (Arbeitskopie)
> @@ -90,7 +90,7 @@
>             </drop-down>
>         </field>
>         <field name="submitButton" title="${uiLabelMap.CommonSave}"><submit button-type="button"/></field>
> -        <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit">
> +        <field name="cancelLink" title=" " widget-style="smallSubmit">
>             <hyperlink target="${donePage}" also-hidden="false" description="${uiLabelMap.CommonCancelDone}">
>                 <parameter param-name="partyId"/>
>             </hyperlink>
> 

Re: CommonEmptyHeader

Posted by Adrian Crum <ad...@sandglass-software.com>.
On 5/16/2012 12:33 PM, Christian Geisert wrote:
> Adrian Crum schrieb:
>> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>>> Adrian Crum schrieb:
>>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>>> What's the point of CommonEmptyHeader?
>>>>>
>>>>> It's definied in CommonUiLabels.xml as:
>>>>>
>>>>> <property key="CommonEmptyHeader">
>>>>>        <!-- do not  remove this! -->
>>>>>        <value xml:lang="en" xml:space="preserve">    </value>
>>>>> </property>
>>>>>
>>>>> It is just a simple space (0x20)
>>>>>
>>>>> It is used ~500 times in forms as a title in a field definition
>>>>>
>>>>> Example:
>>>>>
>>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>>      ...
>>>>>      <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>>>
>>>>>        <hyperlink target="${donePage}" also-hidden="false"
>>>>>          description="${uiLabelMap.CommonCancelDone}">
>>>>>          <parameter param-name="partyId"/>
>>>>>        </hyperlink>
>>>>>      </field>
>>>>> </form>
>>>>>
>>>>>
>>>>> This is a button which should have no label, but if the title attribute
>>>>> is empty then the name attribute is used as label.
>>>>>
>>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>>> but exactly same result a using CommonEmptyHeader without the need
>>>>> using
>>>>> CommonEmptyHeader.
>>>>>
>>>>> The real solution is of course not to display a label if the title
>>>>> attribute is empty.
>>>> An empty title attribute is meant to be a shortcut, or a developer's
>>>> convenience - the widgets will use the field name to look up the correct
>>>> label.
>>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>>    - IMHO it is bad for re-using labels...)
>>>
>>>> Putting a space in the title attribute is the only way to turn off the
>>>> default behavior.
>>> Ok, so there is nothing against replacing
>>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>>>
>> That is what we would like to do - but it doesn't work. That is what
>> needs to be fixed.
> But if I do this in the above mentioned example (see attached patch) it
> seems to give the expected result (= no label). I'm a missing something?

Most likely I am missing something. The last time I checked it didn't 
work - but that was a long time ago. Maybe it has been fixed since then.

-Adrian


Re: CommonEmptyHeader

Posted by Christian Geisert <ch...@isu-gmbh.de>.
Adrian Crum schrieb:
> On 5/16/2012 12:17 PM, Christian Geisert wrote:
>> Adrian Crum schrieb:
>>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>>> What's the point of CommonEmptyHeader?
>>>>
>>>> It's definied in CommonUiLabels.xml as:
>>>>
>>>> <property key="CommonEmptyHeader">
>>>>       <!-- do not  remove this! -->
>>>>       <value xml:lang="en" xml:space="preserve">   </value>
>>>> </property>
>>>>
>>>> It is just a simple space (0x20)
>>>>
>>>> It is used ~500 times in forms as a title in a field definition
>>>>
>>>> Example:
>>>>
>>>> <form name="EditPerson" type="single" target="updatePerson"
>>>>     ...
>>>>     <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>>
>>>>       <hyperlink target="${donePage}" also-hidden="false"
>>>>         description="${uiLabelMap.CommonCancelDone}">
>>>>         <parameter param-name="partyId"/>
>>>>       </hyperlink>
>>>>     </field>
>>>> </form>
>>>>
>>>>
>>>> This is a button which should have no label, but if the title attribute
>>>> is empty then the name attribute is used as label.
>>>>
>>>> Why not just put a space (" ") into the title attribute - still a hack,
>>>> but exactly same result a using CommonEmptyHeader without the need
>>>> using
>>>> CommonEmptyHeader.
>>>>
>>>> The real solution is of course not to display a label if the title
>>>> attribute is empty.
>>> An empty title attribute is meant to be a shortcut, or a developer's
>>> convenience - the widgets will use the field name to look up the correct
>>> label.
>> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>>   - IMHO it is bad for re-using labels...)
>>
>>> Putting a space in the title attribute is the only way to turn off the
>>> default behavior.
>> Ok, so there is nothing against replacing
>> "${uiLabelMap.CommonEmptyHeader}" with " "?
>>
> 
> That is what we would like to do - but it doesn't work. That is what
> needs to be fixed.

But if I do this in the above mentioned example (see attached patch) it
seems to give the expected result (= no label). I'm a missing something?

Christian


Re: CommonEmptyHeader

Posted by Adrian Crum <ad...@sandglass-software.com>.
On 5/16/2012 12:17 PM, Christian Geisert wrote:
> Adrian Crum schrieb:
>> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>>> What's the point of CommonEmptyHeader?
>>>
>>> It's definied in CommonUiLabels.xml as:
>>>
>>> <property key="CommonEmptyHeader">
>>>       <!-- do not  remove this! -->
>>>       <value xml:lang="en" xml:space="preserve">   </value>
>>> </property>
>>>
>>> It is just a simple space (0x20)
>>>
>>> It is used ~500 times in forms as a title in a field definition
>>>
>>> Example:
>>>
>>> <form name="EditPerson" type="single" target="updatePerson"
>>>     ...
>>>     <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>>
>>>       <hyperlink target="${donePage}" also-hidden="false"
>>>         description="${uiLabelMap.CommonCancelDone}">
>>>         <parameter param-name="partyId"/>
>>>       </hyperlink>
>>>     </field>
>>> </form>
>>>
>>>
>>> This is a button which should have no label, but if the title attribute
>>> is empty then the name attribute is used as label.
>>>
>>> Why not just put a space (" ") into the title attribute - still a hack,
>>> but exactly same result a using CommonEmptyHeader without the need using
>>> CommonEmptyHeader.
>>>
>>> The real solution is of course not to display a label if the title
>>> attribute is empty.
>> An empty title attribute is meant to be a shortcut, or a developer's
>> convenience - the widgets will use the field name to look up the correct
>> label.
> Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
>   - IMHO it is bad for re-using labels...)
>
>> Putting a space in the title attribute is the only way to turn off the
>> default behavior.
> Ok, so there is nothing against replacing
> "${uiLabelMap.CommonEmptyHeader}" with " "?
>

That is what we would like to do - but it doesn't work. That is what 
needs to be fixed.

-Adrian



Re: CommonEmptyHeader

Posted by Christian Geisert <ch...@isu-gmbh.de>.
Adrian Crum schrieb:
> On 5/16/2012 11:44 AM, Christian Geisert wrote:
>> What's the point of CommonEmptyHeader?
>>
>> It's definied in CommonUiLabels.xml as:
>>
>> <property key="CommonEmptyHeader">
>>      <!-- do not  remove this! -->
>>      <value xml:lang="en" xml:space="preserve">  </value>
>> </property>
>>
>> It is just a simple space (0x20)
>>
>> It is used ~500 times in forms as a title in a field definition
>>
>> Example:
>>
>> <form name="EditPerson" type="single" target="updatePerson"
>>    ...
>>    <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>>
>>      <hyperlink target="${donePage}" also-hidden="false"
>>        description="${uiLabelMap.CommonCancelDone}">
>>        <parameter param-name="partyId"/>
>>      </hyperlink>
>>    </field>
>> </form>
>>
>>
>> This is a button which should have no label, but if the title attribute
>> is empty then the name attribute is used as label.
>>
>> Why not just put a space (" ") into the title attribute - still a hack,
>> but exactly same result a using CommonEmptyHeader without the need using
>> CommonEmptyHeader.
>>
>> The real solution is of course not to display a label if the title
>> attribute is empty.
> 
> An empty title attribute is meant to be a shortcut, or a developer's
> convenience - the widgets will use the field name to look up the correct
> label.

Ah, ok that's this FormFieldTitle_ stuff (which I don't like and use ;-)
 - IMHO it is bad for re-using labels...)

> Putting a space in the title attribute is the only way to turn off the
> default behavior.

Ok, so there is nothing against replacing
"${uiLabelMap.CommonEmptyHeader}" with " "?

Christian

Re: CommonEmptyHeader

Posted by Adrian Crum <ad...@sandglass-software.com>.
On 5/16/2012 11:44 AM, Christian Geisert wrote:
> What's the point of CommonEmptyHeader?
>
> It's definied in CommonUiLabels.xml as:
>
> <property key="CommonEmptyHeader">
>      <!-- do not  remove this! -->
>      <value xml:lang="en" xml:space="preserve">  </value>
> </property>
>
> It is just a simple space (0x20)
>
> It is used ~500 times in forms as a title in a field definition
>
> Example:
>
> <form name="EditPerson" type="single" target="updatePerson"
>    ...
>    <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"
>
>      <hyperlink target="${donePage}" also-hidden="false"
>        description="${uiLabelMap.CommonCancelDone}">
>        <parameter param-name="partyId"/>
>      </hyperlink>
>    </field>
> </form>
>
>
> This is a button which should have no label, but if the title attribute
> is empty then the name attribute is used as label.
>
> Why not just put a space (" ") into the title attribute - still a hack,
> but exactly same result a using CommonEmptyHeader without the need using
> CommonEmptyHeader.
>
> The real solution is of course not to display a label if the title
> attribute is empty.

An empty title attribute is meant to be a shortcut, or a developer's 
convenience - the widgets will use the field name to look up the correct 
label.

Putting a space in the title attribute is the only way to turn off the 
default behavior.

-Adrian


CommonEmptyHeader (was: Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/)

Posted by Christian Geisert <ch...@isu-gmbh.de>.
What's the point of CommonEmptyHeader?

It's definied in CommonUiLabels.xml as:

<property key="CommonEmptyHeader">
    <!-- do not  remove this! -->
    <value xml:lang="en" xml:space="preserve"> </value>
</property>

It is just a simple space (0x20)

It is used ~500 times in forms as a title in a field definition

Example:

<form name="EditPerson" type="single" target="updatePerson"
  ...
  <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}"

    <hyperlink target="${donePage}" also-hidden="false"
      description="${uiLabelMap.CommonCancelDone}">
      <parameter param-name="partyId"/>
    </hyperlink>
  </field>
</form>


This is a button which should have no label, but if the title attribute
is empty then the name attribute is used as label.

Why not just put a space (" ") into the title attribute - still a hack,
but exactly same result a using CommonEmptyHeader without the need using
CommonEmptyHeader.

The real solution is of course not to display a label if the title
attribute is empty.

Christian

Adrian Crum schrieb:
> The bad thing about this change is that it is not necessary. This change
> hides a problem - it does not solve it. I mentioned that in the Jira issue.
> 
> The method is supposed to pretty-print an XML document, and if you turn
> off space removal, the indentation will be wrong. In other words, it
> will not be pretty.
> 
> -1 on this change in any version.
> 
> -Adrian
> 
> On 5/16/2012 2:25 AM, Scott Gray wrote:
>> I see in your subsequent commits that you encountered the problems
>> caused by this type of change.
>>
>> They're also a pretty good indication that once again you didn't
>> compile or test before back-porting, I'm not sure what I can do to
>> make the need for this any clearer to you.  Please remember your
>> responsibilities as a committer.
>>
>> Regards
>> Scott
>>
>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>
>>> You've changed the signature on the UtilXml methods, that should not
>>> be done and especially not be back-ported to the branches.  Even in
>>> the trunk the correct thing to do is to add a new method with the new
>>> signature and then (if needed) deprecate the old method.  Obviously
>>> deprecation shouldn't be back-ported.
>>>
>>> There's nothing new in this comment Jacques, the general rule of
>>> thumb is never change a method signature unless it is private.
>>>
>>> Regards
>>> Scott
>>>
>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>
>>>> Author: jleroux
>>>> Date: Tue May 15 19:11:13 2012
>>>> New Revision: 1338836
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>> Log:
>>>> "Applied fix from trunk for revision: 1338831" (conflict in
>>>> CommonUiLabels.xml handled by hand)
>>>> ------------------------------------------------------------------------
>>>>
>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) |
>>>> 14 lines
>>>>
>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label
>>>> Manager is wrongly overriding CommonEmptyHeader"
>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this
>>>> allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>> * Adds some French labels into CommonUiLabels.xml using Labels
>>>> Manager to test the new functionality
>>>> * Adds the xml:space attribute into the valueType complexType
>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>
>>>> I got an issue when 1st trying to commit:
>>>> Commit failed (details follow):
>>>> While preparing
>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml'
>>>> for commit
>>>> Inconsistent line ending style
>>>>
>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>> ------------------------------------------------------------------------
>>>>
>>>> 
>>>>
>>>> Modified:
>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>   
>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>
>>>>   
>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>   
>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>
>>>>
>>>> Propchange: ofbiz/branches/release12.04/
>>>> ------------------------------------------------------------------------------
>>>>
>>>> Merged /ofbiz/trunk:r1338831
>>>>
>>>> Modified:
>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>> (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>> Tue May 15 19:11:13 2012
>>>> @@ -29,4 +29,5 @@ under the License.
>>>>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd"
>>>> uri="jndi-config.xsd"/>
>>>>     <system
>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd"
>>>> uri="ofbiz-component.xsd"/>
>>>>     <system
>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd"
>>>> uri="ofbiz-containers.xsd"/>
>>>> +<system
>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd"
>>>> uri="ofbiz-properties.xsd"/>
>>>> </catalog>
>>>>
>>>> Modified:
>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> ---
>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>> (original)
>>>> +++
>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>> Tue May 15 19:11:13 2012
>>>> @@ -42,6 +42,7 @@ under the License.
>>>>         <xs:simpleContent>
>>>>             <xs:extension base="xs:string">
>>>>                 <xs:attribute ref="xml:lang"/>
>>>> +<xs:attribute ref="xml:space"/>
>>>>             </xs:extension>
>>>>         </xs:simpleContent>
>>>>     </xs:complexType>
>>>>
>>>> Modified:
>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> ---
>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>> (original)
>>>> +++
>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>> Tue May 15 19:11:13 2012
>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>
>>>>     // ----- TrAX Methods ----------------- //
>>>>
>>>> -    /** Creates a JAXP TrAX Transformer suitable for
>>>> pretty-printing an
>>>> -     * XML document. This method is provided as an alternative to the
>>>> -     *
>>>> deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml
>>>> declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing
>>>> an XML document. This method is provided as an alternative to the
>>>> deprecated
>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>> +     *
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If<code>true</code>  the xml declaration will be
>>>> omitted from the output
>>>> +     * @param indent
>>>> +     *            If<code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If<code>indent</code>  is<code>true</code>, the
>>>> number of spaces to indent. Default is 4.
>>>> +     * @param keepSpace
>>>> +     *            If<code>true</code>  spaces are preserved, else
>>>> striped
>>>>      * @return A<code>Transformer</code>  instance
>>>>      * @see<a
>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP
>>>> TrAX</a>
>>>>      * @throws TransformerConfigurationException
>>>>      */
>>>> -    public static Transformer createOutputTransformer(String
>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount) throws TransformerConfigurationException {
>>>> +    public static Transformer createOutputTransformer(String
>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount, boolean keepSpace)
>>>> +            throws TransformerConfigurationException {
>>>>         StringBuilder sb = new StringBuilder();
>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>         sb.append("<xsl:stylesheet
>>>> xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>             sb.append("\"");
>>>>         }
>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        if (keepSpace) {
>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>> +        } else {
>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        }
>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>         sb.append("<xsl:copy><xsl:apply-templates
>>>> select=\"@*|node()\"/></xsl:copy>\n");
>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>         transformer.transform(source, result);
>>>>     }
>>>>
>>>> -    /** Serializes a DOM<code>Node</code>  to
>>>> an<code>OutputStream</code>
>>>> -     * using JAXP TrAX.
>>>> -     * @param node The<code>Node</code>  to serialize
>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml
>>>> declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Serializes a DOM<code>Node</code>  to
>>>> an<code>OutputStream</code>  using JAXP TrAX.
>>>> +     *
>>>> +     * @param node
>>>> +     *            The<code>Node</code>  to serialize
>>>> +     * @param os
>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If<code>true</code>  the xml declaration will be
>>>> omitted from the output
>>>> +     * @param keepSpace
>>>> +     *            If<code>true</code>  spaces are preserved, else
>>>> striped
>>>> +     * @param indent
>>>> +     *            If<code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If<code>indent</code>  is<code>true</code>, the
>>>> number of spaces to indent. Default is 4.
>>>>      * @see<a
>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP
>>>> TrAX</a>
>>>>      * @throws TransformerException
>>>>      */
>>>> -    public static void writeXmlDocument(Node node, OutputStream os,
>>>> String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount) throws TransformerException {
>>>> -        Transformer transformer = createOutputTransformer(encoding,
>>>> omitXmlDeclaration, indent, indentAmount);
>>>> +    public static void writeXmlDocument(Node node, OutputStream os,
>>>> String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount,
>>>> +            boolean keepSpace) throws TransformerException {
>>>> +        Transformer transformer = createOutputTransformer(encoding,
>>>> omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>         transformDomDocument(transformer, node, os);
>>>>     }
>>>>
>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>             return;
>>>>         }
>>>>         // OutputFormat defaults are: indent on, indent = 4, include
>>>> XML declaration,
>>>> -        // charset = UTF-8, line width = 72
>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>         try {
>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4,
>>>> false);
>>>>         } catch (TransformerException e) {
>>>>             // Wrapping this exception for backwards compatibility
>>>>             throw new IOException(e.getMessage());
>>>>
>>>> Modified:
>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> ---
>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>> (original)
>>>> +++
>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>> Tue May 15 19:11:13 2012
>>>> @@ -8,6 +8,7 @@
>>>>     to you under the Apache License, Version 2.0 (the
>>>>     "License"); you may not use this file except in compliance
>>>>     with the License.  You may obtain a copy of the License at
>>>> +
>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>
>>>>     Unless required by applicable law or agreed to in writing,
>>>> @@ -17,13 +18,13 @@
>>>>     specific language governing permissions and limitations
>>>>     under the License.
>>>> -->
>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>
>>>>     <property key="AP">
>>>>         <value xml:lang="de">Kreditoren</value>
>>>>         <value xml:lang="en">AP</value>
>>>>         <value xml:lang="es">Compras</value>
>>>>         <value xml:lang="fr">Cpt. fourn.</value>
>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>         <value xml:lang="it">AP</value>
>>>>         <value xml:lang="nl">Schulden</value>
>>>>         <value xml:lang="pt_BR">Contas a pagar</value>
>>>> @@ -127,6 +128,7 @@
>>>>     <property key="CommonAbort">
>>>>         <value xml:lang="en">Abort</value>
>>>>         <value xml:lang="es">Cancelar</value>
>>>> +<value xml:lang="fr">Abandonner</value>
>>>>         <value xml:lang="vi">Hủy</value>
>>>>     </property>
>>>>     <property key="CommonAccepted">
>>>> @@ -413,6 +415,7 @@
>>>>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>         <value xml:lang="en">Address not found.</value>
>>>>         <value xml:lang="es">Dirección no encontrada.</value>
>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>         <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>     </property>
>>>>     <property key="CommonAddresses">
>>>> @@ -2770,7 +2773,8 @@
>>>>         <value xml:lang="zh_TW">電子郵件</value>
>>>>     </property>
>>>>     <property key="CommonEmptyHeader">
>>>> -<value xml:lang="en" xml:space="preserve">  </value><!-- do not 
>>>> remove this! -->
>>>> +<!-- do not  remove this! -->
>>>> +<value xml:lang="en" xml:space="preserve">  </value>
>>>>     </property>
>>>>     <property key="CommonEnable">
>>>>         <value xml:lang="en">Enable</value>
>>>> @@ -11081,6 +11085,31 @@
>>>>         <value xml:lang="zh">有效日期</value>
>>>>         <value xml:lang="zh_TW">有效日</value>
>>>>     </property>
>>>> +<property key="FormFieldTitle_expireButton">
>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>> +<value xml:lang="cs">Vypršet</value>
>>>> +<value xml:lang="de">Ablaufen</value>
>>>> +<value xml:lang="en">Expire</value>
>>>> +<value xml:lang="es">Expiración</value>
>>>> +<value xml:lang="fr">Invalider</value>
>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>> +<value xml:lang="it">Scade</value>
>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>> +<value xml:lang="pt">Expirar</value>
>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>> +<value xml:lang="ro">Expira</value>
>>>> +<value xml:lang="ru">Прекратить</value>
>>>> +<value xml:lang="th">หมดเขต</value>
>>>> +<value xml:lang="vi">Hết hạn</value>
>>>> +<value xml:lang="zh">过期</value>
>>>> +<value xml:lang="zh-CN">过期</value>
>>>> +<value xml:lang="zh-TW">過期</value>
>>>> +</property>
>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>> +</property>
>>>>     <property key="FormFieldTitle_externalDeviceId">
>>>>         <value xml:lang="en">External Device Id</value>
>>>>         <value xml:lang="es">Código dispositivo externo</value>
>>>> @@ -11091,11 +11120,6 @@
>>>>         <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>         <value xml:lang="fr">Type de Mat. Externe</value>
>>>>     </property>
>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>> -</property>
>>>>     <property key="FormFieldTitle_fromDate">
>>>>         <value xml:lang="ar">تاريخ البدء</value>
>>>>         <value xml:lang="de">Von Datum</value>
>>>>
>>>> Modified:
>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> ---
>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> (original)
>>>> +++
>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> Tue May 15 19:11:13 2012
>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.base.util.UtilXml;
>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>> -
>>>> import org.ofbiz.service.DispatchContext;
>>>> import org.ofbiz.service.ServiceUtil;
>>>> -
>>>> import org.w3c.dom.Comment;
>>>> import org.w3c.dom.Document;
>>>> import org.w3c.dom.Element;
>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>                         if (apacheLicenseText != null) {
>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>                         }
>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos,
>>>> "UTF-8", !(apacheLicenseText == null), true, 4);
>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos,
>>>> "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>                     } finally {
>>>>                         fos.close();
>>>>                         // clear cache to see immediately the new
>>>> labels and
>>>>
>>>>
> 


Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adrian Crum <ad...@sandglass-software.com>.
Thank you.

There is a chance the XML parser treats an attribute containing a single 
space as an empty attribute. If that is the case, then the widget 
schemas can be updated to prevent that interpretation.

-Adrian


On 5/16/2012 10:03 AM, Jacques Le Roux wrote:
> Thanks for the answer. What I really missed is the point 4: the whole 
> file is rewritten for each label change
>
> OK I will revert and try to fix the empty title issue. It seems indeed 
> to be the only reason why CommonEmptyHeader  is used. I need to double 
> check that before though, there are 491 occurences
>
> Jacques
>
>
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> I tried to explain it to you in the Jira issue and in my initial 
>> response to this commit. Clearly, you are not understanding the 
>> problem. If you don't understand the problem, then you shouldn't be 
>> committing half-baked "solutions."
>>
>> I will try to explain it again:
>>
>> 1. CommonEmptyHeader exists as a workaround to a flaw in the screen 
>> widget rendering. The simple fact that a single space character - 
>> which never needs to be translated - is in the UI label file makes it 
>> obvious that it is a hack.
>>
>> 2. Label Manager removes the single space from CommonEmptyHeader  
>> while saving changes to the file. That is because a stylesheet is 
>> used to format the XML, and the stylesheet removes the space.
>>
>> 3. The correct solution to this problem (#2) is to fix the screen 
>> widget rendering (#1).
>>
>> 4. Disabling space removal in the stylesheet effectively disables the 
>> entire stylesheet. The whole point of the method you modified is to 
>> strip all spaces from the XML, and then indent the XML with the 
>> specified spacing. If you turn off the space removal then the XML 
>> will not be indented properly.
>>
>> I can't make it any simpler than that.
>>
>> In case you missed it in my previous replies:
>>
>> -1 on this commit and the others like it.
>>
>> If you can't understand the problem, then that's fine - revert the 
>> code and unassign yourself from the Jira issue so someone more 
>> qualified can fix it.
>>
>> -Adrian
>>
>> On 5/16/2012 9:05 AM, Jacques Le Roux wrote:
>>> Why don't you answer on my proposition? Why don't you *clearly 
>>> explain* why this change is unnecessary instead of yelling?
>>>
>>> I really want to fix this bug, wich removes the xml:space="preserve" 
>>> attribute from CommonEmptyHeader
>>>
>>> Jacques
>>>
>>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>>> I repeat: THIS CHANGE IS UNNECESSARY.
>>>>
>>>> Please revert it.
>>>>
>>>> And in case you missed it the first time:
>>>>
>>>> -1 on this commit and the others like it.
>>>>
>>>> -Adrian
>>>>
>>>> On 5/16/2012 8:28 AM, Jacques Le Roux wrote:
>>>>> I don't agree, it does not hide a problem, it solves a problem.
>>>>>
>>>>> The (keepSpace=true) version  is only used in 
>>>>> SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed 
>>>>> functionally.
>>>>>
>>>>> Would you not agree with this patch?
>>>>>
>>>>> Index: 
>>>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>> ===================================================================
>>>>> --- 
>>>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>> (revision 1338984)
>>>>> +++ 
>>>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>> (working copy)
>>>>> @@ -113,6 +113,7 @@
>>>>>                 resourceElem.setAttribute("xmlns:xsi", 
>>>>> "http://www.w3.org/2001/XMLSchema-instance");
>>>>>                 
>>>>> resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
>>>>>                 for (String labelKey : labelsList) {
>>>>> +                    boolean keepSpaces = false;
>>>>>                     LabelInfo labelInfo = labels.get(labelKey);
>>>>>                     if 
>>>>> (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
>>>>>                         continue;
>>>>> @@ -136,6 +137,7 @@
>>>>>                             valueElem.setAttribute("xml:lang", 
>>>>> localeFound);
>>>>>                             if (valueString.trim().isEmpty()) {
>>>>>                                 
>>>>> valueElem.setAttribute("xml:space", "preserve");
>>>>> +                                keepSpaces = true;
>>>>>                             }
>>>>>                             if 
>>>>> (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
>>>>>                                 Comment labelComment =
>>>>> resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment())); 
>>>>>
>>>>> @@ -149,7 +151,7 @@
>>>>>                         if (apacheLicenseText != null) {
>>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>>                         }
>>>>> -                        UtilXml.writeXmlDocument(resourceElem, 
>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>> +                        UtilXml.writeXmlDocument(resourceElem, 
>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4, keepSpaces);
>>>>>                     } finally {
>>>>>                         fos.close();
>>>>>                         // clear cache to see immediately the new 
>>>>> labels and
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>>>>> The bad thing about this change is that it is not necessary. This 
>>>>>> change hides a problem - it does not solve it. I mentioned that
>>>>>> in the Jira issue.
>>>>>>
>>>>>> The method is supposed to pretty-print an XML document, and if 
>>>>>> you turn off space removal, the indentation will be wrong. In other
>>>>>> words, it will not be pretty.
>>>>>>
>>>>>> -1 on this change in any version.
>>>>>>
>>>>>> -Adrian
>>>>>>
>>>>>> On 5/16/2012 2:25 AM, Scott Gray wrote:
>>>>>>> I see in your subsequent commits that you encountered the 
>>>>>>> problems caused by this type of change.
>>>>>>>
>>>>>>> They're also a pretty good indication that once again you didn't 
>>>>>>> compile or test before back-porting, I'm not sure what I can do
>>>>>>> to make the need for this any clearer to you.  Please remember 
>>>>>>> your responsibilities as a committer.
>>>>>>>
>>>>>>> Regards
>>>>>>> Scott
>>>>>>>
>>>>>>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>>>>>>
>>>>>>>> You've changed the signature on the UtilXml methods, that 
>>>>>>>> should not be done and especially not be back-ported to the 
>>>>>>>> branches.
>>>>>>>> Even in the trunk the correct thing to do is to add a new 
>>>>>>>> method with the new signature and then (if needed) deprecate 
>>>>>>>> the old
>>>>>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>>>>>
>>>>>>>> There's nothing new in this comment Jacques, the general rule 
>>>>>>>> of thumb is never change a method signature unless it is private.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Scott
>>>>>>>>
>>>>>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>>>>>
>>>>>>>>> Author: jleroux
>>>>>>>>> Date: Tue May 15 19:11:13 2012
>>>>>>>>> New Revision: 1338836
>>>>>>>>>
>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>>>>>> Log:
>>>>>>>>> "Applied fix from trunk for revision: 1338831" (conflict in 
>>>>>>>>> CommonUiLabels.xml handled by hand)
>>>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>>>
>>>>>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 
>>>>>>>>> 2012) | 14 lines
>>>>>>>>>
>>>>>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The 
>>>>>>>>> Label Manager is wrongly overriding CommonEmptyHeader"
>>>>>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this 
>>>>>>>>> allows to use xsl:preserve-space into
>>>>>>>>> UtilXml.createOutputTransformer()
>>>>>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>>>>>> * Adds some French labels into CommonUiLabels.xml using Labels 
>>>>>>>>> Manager to test the new functionality
>>>>>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>>>>>
>>>>>>>>> I got an issue when 1st trying to commit:
>>>>>>>>> Commit failed (details follow):
>>>>>>>>> While preparing
>>>>>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' 
>>>>>>>>> for commit
>>>>>>>>> Inconsistent line ending style
>>>>>>>>>
>>>>>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>>>
>>>>>>>>> 
>>>>>>>>>
>>>>>>>>> Modified:
>>>>>>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>>>>>>    
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>>>>    
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>>>>
>>>>>>>>>    
>>>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>>>>    
>>>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>>>
>>>>>>>>>    
>>>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>>>>
>>>>>>>>> Propchange: ofbiz/branches/release12.04/
>>>>>>>>> ------------------------------------------------------------------------------ 
>>>>>>>>>
>>>>>>>>> Merged /ofbiz/trunk:r1338831
>>>>>>>>>
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>>>
>>>>>>>>> ============================================================================== 
>>>>>>>>>
>>>>>>>>> --- 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original) 
>>>>>>>>>
>>>>>>>>> +++ 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue 
>>>>>>>>> May 15 19:11:13 2012
>>>>>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>>>>>> <system 
>>>>>>>>> systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" 
>>>>>>>>> uri="jndi-config.xsd"/>
>>>>>>>>> <system 
>>>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" 
>>>>>>>>> uri="ofbiz-component.xsd"/>
>>>>>>>>> <system 
>>>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" 
>>>>>>>>> uri="ofbiz-containers.xsd"/>
>>>>>>>>> +<system 
>>>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" 
>>>>>>>>> uri="ofbiz-properties.xsd"/>
>>>>>>>>> </catalog>
>>>>>>>>>
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>>>>
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>>>
>>>>>>>>> ============================================================================== 
>>>>>>>>>
>>>>>>>>> --- 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>>>> (original)
>>>>>>>>> +++ 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>>>> Tue May 15 19:11:13 2012
>>>>>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>>>>>> <xs:simpleContent>
>>>>>>>>> <xs:extension base="xs:string">
>>>>>>>>> <xs:attribute ref="xml:lang"/>
>>>>>>>>> +<xs:attribute ref="xml:space"/>
>>>>>>>>> </xs:extension>
>>>>>>>>> </xs:simpleContent>
>>>>>>>>> </xs:complexType>
>>>>>>>>>
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>>>
>>>>>>>>> ============================================================================== 
>>>>>>>>>
>>>>>>>>> --- 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>>>>>> (original)
>>>>>>>>> +++ 
>>>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>>>>>> Tue May 15 19:11:13 2012
>>>>>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>>>>>
>>>>>>>>>     // ----- TrAX Methods ----------------- //
>>>>>>>>>
>>>>>>>>> -    /** Creates a JAXP TrAX Transformer suitable for 
>>>>>>>>> pretty-printing an
>>>>>>>>> -     * XML document. This method is provided as an 
>>>>>>>>> alternative to the
>>>>>>>>> -     * 
>>>>>>>>> deprecated<code>org.apache.xml.serialize.OutputFormat</code>  
>>>>>>>>> class.
>>>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>>>>>> declaration
>>>>>>>>> -     * will be omitted from the output
>>>>>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>>>>>> indented
>>>>>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>>>>>> is<code>true</code>,
>>>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>>>> +    /**
>>>>>>>>> +     * Creates a JAXP TrAX Transformer suitable for 
>>>>>>>>> pretty-printing an XML document. This method is provided as an 
>>>>>>>>> alternative
>>>>>>>>> to the deprecated
>>>>>>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>>>>> +     *
>>>>>>>>> +     * @param encoding
>>>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>>>> +     * @param omitXmlDeclaration
>>>>>>>>> +     *            If<code>true</code>  the xml declaration 
>>>>>>>>> will be omitted from the output
>>>>>>>>> +     * @param indent
>>>>>>>>> +     *            If<code>true</code>, the output will be 
>>>>>>>>> indented
>>>>>>>>> +     * @param indentAmount
>>>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, 
>>>>>>>>> the number of spaces to indent. Default is 4.
>>>>>>>>> +     * @param keepSpace
>>>>>>>>> +     *            If<code>true</code>  spaces are preserved, 
>>>>>>>>> else striped
>>>>>>>>>      * @return A<code>Transformer</code>  instance
>>>>>>>>>      * @see<a 
>>>>>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>>>>>> TrAX</a>
>>>>>>>>>      * @throws TransformerConfigurationException
>>>>>>>>>      */
>>>>>>>>> -    public static Transformer createOutputTransformer(String 
>>>>>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>>>> indentAmount) throws TransformerConfigurationException {
>>>>>>>>> +    public static Transformer createOutputTransformer(String 
>>>>>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>>>> indentAmount, boolean keepSpace)
>>>>>>>>> +            throws TransformerConfigurationException {
>>>>>>>>>         StringBuilder sb = new StringBuilder();
>>>>>>>>>         sb.append("<?xml version=\"1.0\" 
>>>>>>>>> encoding=\"UTF-8\"?>\n");
>>>>>>>>>         sb.append("<xsl:stylesheet 
>>>>>>>>> xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>>>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>>>>>>             sb.append("\"");
>>>>>>>>>         }
>>>>>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>>>>> +        if (keepSpace) {
>>>>>>>>> +            sb.append("/>\n<xsl:preserve-space 
>>>>>>>>> elements=\"*\"/>\n");
>>>>>>>>> +        } else {
>>>>>>>>> +            sb.append("/>\n<xsl:strip-space 
>>>>>>>>> elements=\"*\"/>\n");
>>>>>>>>> +        }
>>>>>>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>>>>>         sb.append("<xsl:copy><xsl:apply-templates 
>>>>>>>>> select=\"@*|node()\"/></xsl:copy>\n");
>>>>>>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>>>>>         transformer.transform(source, result);
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>> -    /** Serializes a DOM<code>Node</code>  to 
>>>>>>>>> an<code>OutputStream</code>
>>>>>>>>> -     * using JAXP TrAX.
>>>>>>>>> -     * @param node The<code>Node</code>  to serialize
>>>>>>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>>>>>> declaration
>>>>>>>>> -     * will be omitted from the output
>>>>>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>>>>>> indented
>>>>>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>>>>>> is<code>true</code>,
>>>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>>>> +    /**
>>>>>>>>> +     * Serializes a DOM<code>Node</code>  to 
>>>>>>>>> an<code>OutputStream</code>  using JAXP TrAX.
>>>>>>>>> +     *
>>>>>>>>> +     * @param node
>>>>>>>>> +     *            The<code>Node</code>  to serialize
>>>>>>>>> +     * @param os
>>>>>>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>>>>>>> +     * @param encoding
>>>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>>>> +     * @param omitXmlDeclaration
>>>>>>>>> +     *            If<code>true</code>  the xml declaration 
>>>>>>>>> will be omitted from the output
>>>>>>>>> +     * @param keepSpace
>>>>>>>>> +     *            If<code>true</code>  spaces are preserved, 
>>>>>>>>> else striped
>>>>>>>>> +     * @param indent
>>>>>>>>> +     *            If<code>true</code>, the output will be 
>>>>>>>>> indented
>>>>>>>>> +     * @param indentAmount
>>>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, 
>>>>>>>>> the number of spaces to indent. Default is 4.
>>>>>>>>>      * @see<a 
>>>>>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>>>>>> TrAX</a>
>>>>>>>>>      * @throws TransformerException
>>>>>>>>>      */
>>>>>>>>> -    public static void writeXmlDocument(Node node, 
>>>>>>>>> OutputStream os, String encoding, boolean omitXmlDeclaration, 
>>>>>>>>> boolean
>>>>>>>>> indent, int indentAmount) throws TransformerException {
>>>>>>>>> -        Transformer transformer = 
>>>>>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>>>>>> indentAmount);
>>>>>>>>> +    public static void writeXmlDocument(Node node, 
>>>>>>>>> OutputStream os, String encoding, boolean omitXmlDeclaration, 
>>>>>>>>> boolean
>>>>>>>>> indent, int indentAmount,
>>>>>>>>> +            boolean keepSpace) throws TransformerException {
>>>>>>>>> +        Transformer transformer = 
>>>>>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>>>>>> indentAmount, keepSpace);
>>>>>>>>>         transformDomDocument(transformer, node, os);
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>>>>>             return;
>>>>>>>>>         }
>>>>>>>>>         // OutputFormat defaults are: indent on, indent = 4, 
>>>>>>>>> include XML declaration,
>>>>>>>>> -        // charset = UTF-8, line width = 72
>>>>>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>>>>>         try {
>>>>>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 
>>>>>>>>> 4, false);
>>>>>>>>>         } catch (TransformerException e) {
>>>>>>>>>             // Wrapping this exception for backwards 
>>>>>>>>> compatibility
>>>>>>>>>             throw new IOException(e.getMessage());
>>>>>>>>>
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>>>
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>>>
>>>>>>>>> ============================================================================== 
>>>>>>>>>
>>>>>>>>> --- 
>>>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>>> (original)
>>>>>>>>> +++ 
>>>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>>> Tue May 15 19:11:13 2012
>>>>>>>>> @@ -8,6 +8,7 @@
>>>>>>>>>     to you under the Apache License, Version 2.0 (the
>>>>>>>>>     "License"); you may not use this file except in compliance
>>>>>>>>>     with the License.  You may obtain a copy of the License at
>>>>>>>>> +
>>>>>>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>>>
>>>>>>>>>     Unless required by applicable law or agreed to in writing,
>>>>>>>>> @@ -17,13 +18,13 @@
>>>>>>>>>     specific language governing permissions and limitations
>>>>>>>>>     under the License.
>>>>>>>>> -->
>>>>>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd"> 
>>>>>>>>>
>>>>>>>>> <property key="AP">
>>>>>>>>> <value xml:lang="de">Kreditoren</value>
>>>>>>>>> <value xml:lang="en">AP</value>
>>>>>>>>> <value xml:lang="es">Compras</value>
>>>>>>>>> <value xml:lang="fr">Cpt. fourn.</value>
>>>>>>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>>>>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>>>>>> <value xml:lang="it">AP</value>
>>>>>>>>> <value xml:lang="nl">Schulden</value>
>>>>>>>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>>>>>>>> @@ -127,6 +128,7 @@
>>>>>>>>> <property key="CommonAbort">
>>>>>>>>> <value xml:lang="en">Abort</value>
>>>>>>>>> <value xml:lang="es">Cancelar</value>
>>>>>>>>> +<value xml:lang="fr">Abandonner</value>
>>>>>>>>> <value xml:lang="vi">Hủy</value>
>>>>>>>>> </property>
>>>>>>>>> <property key="CommonAccepted">
>>>>>>>>> @@ -413,6 +415,7 @@
>>>>>>>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>>>>>> <value xml:lang="en">Address not found.</value>
>>>>>>>>> <value xml:lang="es">Dirección no encontrada.</value>
>>>>>>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>>>>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>>>>>> </property>
>>>>>>>>> <property key="CommonAddresses">
>>>>>>>>> @@ -2770,7 +2773,8 @@
>>>>>>>>> <value xml:lang="zh_TW">電子郵件</value>
>>>>>>>>> </property>
>>>>>>>>> <property key="CommonEmptyHeader">
>>>>>>>>> -<value xml:lang="en" xml:space="preserve"> </value><!-- do 
>>>>>>>>> not  remove this! -->
>>>>>>>>> +<!-- do not  remove this! -->
>>>>>>>>> +<value xml:lang="en" xml:space="preserve"> </value>
>>>>>>>>> </property>
>>>>>>>>> <property key="CommonEnable">
>>>>>>>>> <value xml:lang="en">Enable</value>
>>>>>>>>> @@ -11081,6 +11085,31 @@
>>>>>>>>> <value xml:lang="zh">有效日期</value>
>>>>>>>>> <value xml:lang="zh_TW">有效日</value>
>>>>>>>>> </property>
>>>>>>>>> +<property key="FormFieldTitle_expireButton">
>>>>>>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>>>>>>> +<value xml:lang="cs">Vypršet</value>
>>>>>>>>> +<value xml:lang="de">Ablaufen</value>
>>>>>>>>> +<value xml:lang="en">Expire</value>
>>>>>>>>> +<value xml:lang="es">Expiración</value>
>>>>>>>>> +<value xml:lang="fr">Invalider</value>
>>>>>>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>>>>>>> +<value xml:lang="it">Scade</value>
>>>>>>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>>>>>>> +<value xml:lang="pt">Expirar</value>
>>>>>>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>>>>>>> +<value xml:lang="ro">Expira</value>
>>>>>>>>> +<value xml:lang="ru">Прекратить</value>
>>>>>>>>> +<value xml:lang="th">หมดเขต</value>
>>>>>>>>> +<value xml:lang="vi">Hết hạn</value>
>>>>>>>>> +<value xml:lang="zh">过期</value>
>>>>>>>>> +<value xml:lang="zh-CN">过期</value>
>>>>>>>>> +<value xml:lang="zh-TW">過期</value>
>>>>>>>>> +</property>
>>>>>>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>>>>>>> +</property>
>>>>>>>>> <property key="FormFieldTitle_externalDeviceId">
>>>>>>>>> <value xml:lang="en">External Device Id</value>
>>>>>>>>> <value xml:lang="es">Código dispositivo externo</value>
>>>>>>>>> @@ -11091,11 +11120,6 @@
>>>>>>>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>>>>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>>>>>>>> </property>
>>>>>>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>>>>>>> -</property>
>>>>>>>>> <property key="FormFieldTitle_fromDate">
>>>>>>>>> <value xml:lang="ar">تاريخ البدء</value>
>>>>>>>>> <value xml:lang="de">Von Datum</value>
>>>>>>>>>
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>>>
>>>>>>>>> ============================================================================== 
>>>>>>>>>
>>>>>>>>> --- 
>>>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>>>>>> (original)
>>>>>>>>> +++ 
>>>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>>>>>> Tue May 15
>>>>>>>>> 19:11:13 2012
>>>>>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>>>>>> import org.ofbiz.base.util.UtilXml;
>>>>>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>>>>>> -
>>>>>>>>> import org.ofbiz.service.DispatchContext;
>>>>>>>>> import org.ofbiz.service.ServiceUtil;
>>>>>>>>> -
>>>>>>>>> import org.w3c.dom.Comment;
>>>>>>>>> import org.w3c.dom.Document;
>>>>>>>>> import org.w3c.dom.Element;
>>>>>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>>>>>                         if (apacheLicenseText != null) {
>>>>>>>>>                             
>>>>>>>>> fos.write(apacheLicenseText.getBytes());
>>>>>>>>>                         }
>>>>>>>>> -                        
>>>>>>>>> UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", 
>>>>>>>>> !(apacheLicenseText == null), true, 4);
>>>>>>>>> +                        
>>>>>>>>> UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", 
>>>>>>>>> !(apacheLicenseText == null), true, 4, true);
>>>>>>>>>                     } finally {
>>>>>>>>>                         fos.close();
>>>>>>>>>                         // clear cache to see immediately the 
>>>>>>>>> new labels and
>>>>>>>>>
>>>>>>>>>

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks for the answer. What I really missed is the point 4: the whole file is rewritten for each label change

OK I will revert and try to fix the empty title issue. It seems indeed to be the only reason why CommonEmptyHeader  is used. I need 
to double check that before though, there are 491 occurences

Jacques


From: "Adrian Crum" <ad...@sandglass-software.com>
>I tried to explain it to you in the Jira issue and in my initial response to this commit. Clearly, you are not understanding the 
>problem. If you don't understand the problem, then you shouldn't be committing half-baked "solutions."
>
> I will try to explain it again:
>
> 1. CommonEmptyHeader exists as a workaround to a flaw in the screen widget rendering. The simple fact that a single space 
> character - which never needs to be translated - is in the UI label file makes it obvious that it is a hack.
>
> 2. Label Manager removes the single space from CommonEmptyHeader  while saving changes to the file. That is because a stylesheet 
> is used to format the XML, and the stylesheet removes the space.
>
> 3. The correct solution to this problem (#2) is to fix the screen widget rendering (#1).
>
> 4. Disabling space removal in the stylesheet effectively disables the entire stylesheet. The whole point of the method you 
> modified is to strip all spaces from the XML, and then indent the XML with the specified spacing. If you turn off the space 
> removal then the XML will not be indented properly.
>
> I can't make it any simpler than that.
>
> In case you missed it in my previous replies:
>
> -1 on this commit and the others like it.
>
> If you can't understand the problem, then that's fine - revert the code and unassign yourself from the Jira issue so someone more 
> qualified can fix it.
>
> -Adrian
>
> On 5/16/2012 9:05 AM, Jacques Le Roux wrote:
>> Why don't you answer on my proposition? Why don't you *clearly explain* why this change is unnecessary instead of yelling?
>>
>> I really want to fix this bug, wich removes the xml:space="preserve" attribute from CommonEmptyHeader
>>
>> Jacques
>>
>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>> I repeat: THIS CHANGE IS UNNECESSARY.
>>>
>>> Please revert it.
>>>
>>> And in case you missed it the first time:
>>>
>>> -1 on this commit and the others like it.
>>>
>>> -Adrian
>>>
>>> On 5/16/2012 8:28 AM, Jacques Le Roux wrote:
>>>> I don't agree, it does not hide a problem, it solves a problem.
>>>>
>>>> The (keepSpace=true) version  is only used in SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed functionally.
>>>>
>>>> Would you not agree with this patch?
>>>>
>>>> Index: framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> ===================================================================
>>>> --- 
>>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (revision 1338984)
>>>> +++ framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (working copy)
>>>> @@ -113,6 +113,7 @@
>>>>                 resourceElem.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
>>>>                 resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
>>>>                 for (String labelKey : labelsList) {
>>>> +                    boolean keepSpaces = false;
>>>>                     LabelInfo labelInfo = labels.get(labelKey);
>>>>                     if (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
>>>>                         continue;
>>>> @@ -136,6 +137,7 @@
>>>>                             valueElem.setAttribute("xml:lang", localeFound);
>>>>                             if (valueString.trim().isEmpty()) {
>>>>                                 valueElem.setAttribute("xml:space", "preserve");
>>>> +                                keepSpaces = true;
>>>>                             }
>>>>                             if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
>>>>                                 Comment labelComment =
>>>> resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment()));
>>>> @@ -149,7 +151,7 @@
>>>>                         if (apacheLicenseText != null) {
>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>                         }
>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, 
>>>> keepSpaces);
>>>>                     } finally {
>>>>                         fos.close();
>>>>                         // clear cache to see immediately the new labels and
>>>>
>>>> Jacques
>>>>
>>>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>>>> The bad thing about this change is that it is not necessary. This change hides a problem - it does not solve it. I mentioned 
>>>>> that
>>>>> in the Jira issue.
>>>>>
>>>>> The method is supposed to pretty-print an XML document, and if you turn off space removal, the indentation will be wrong. In 
>>>>> other
>>>>> words, it will not be pretty.
>>>>>
>>>>> -1 on this change in any version.
>>>>>
>>>>> -Adrian
>>>>>
>>>>> On 5/16/2012 2:25 AM, Scott Gray wrote:
>>>>>> I see in your subsequent commits that you encountered the problems caused by this type of change.
>>>>>>
>>>>>> They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can 
>>>>>> do
>>>>>> to make the need for this any clearer to you.  Please remember your responsibilities as a committer.
>>>>>>
>>>>>> Regards
>>>>>> Scott
>>>>>>
>>>>>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>>>>>
>>>>>>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the 
>>>>>>> branches.
>>>>>>> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the 
>>>>>>> old
>>>>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>>>>
>>>>>>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is 
>>>>>>> private.
>>>>>>>
>>>>>>> Regards
>>>>>>> Scott
>>>>>>>
>>>>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>>>>
>>>>>>>> Author: jleroux
>>>>>>>> Date: Tue May 15 19:11:13 2012
>>>>>>>> New Revision: 1338836
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>>>>> Log:
>>>>>>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>>
>>>>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>>>>>>
>>>>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>>>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into
>>>>>>>> UtilXml.createOutputTransformer()
>>>>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>>>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>>>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>>>>
>>>>>>>> I got an issue when 1st trying to commit:
>>>>>>>> Commit failed (details follow):
>>>>>>>> While preparing
>>>>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>>>>>>> Inconsistent line ending style
>>>>>>>>
>>>>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>>
>>>>>>>> 
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>>>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>>>>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>>>
>>>>>>>> Propchange: ofbiz/branches/release12.04/
>>>>>>>> ------------------------------------------------------------------------------ 
>>>>>>>>
>>>>>>>> Merged /ofbiz/trunk:r1338831
>>>>>>>>
>>>>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- 
>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>>>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>>>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>>>>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>>>>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>>>>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>>>>>>> +<system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>>>>>>> </catalog>
>>>>>>>>
>>>>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- 
>>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>>>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>>>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>>>>> <xs:simpleContent>
>>>>>>>> <xs:extension base="xs:string">
>>>>>>>> <xs:attribute ref="xml:lang"/>
>>>>>>>> +<xs:attribute ref="xml:space"/>
>>>>>>>> </xs:extension>
>>>>>>>> </xs:simpleContent>
>>>>>>>> </xs:complexType>
>>>>>>>>
>>>>>>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- 
>>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>>>>>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>>>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>>>>
>>>>>>>>     // ----- TrAX Methods ----------------- //
>>>>>>>>
>>>>>>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>>>>>>> -     * XML document. This method is provided as an alternative to the
>>>>>>>> -     * deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>>>>>> -     * will be omitted from the output
>>>>>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>>>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>>> +    /**
>>>>>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an 
>>>>>>>> alternative
>>>>>>>> to the deprecated
>>>>>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>>>> +     *
>>>>>>>> +     * @param encoding
>>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>>> +     * @param omitXmlDeclaration
>>>>>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>>>>>> +     * @param indent
>>>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>>>> +     * @param indentAmount
>>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>>>>>> +     * @param keepSpace
>>>>>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>>>>>>      * @return A<code>Transformer</code>  instance
>>>>>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>>>>      * @throws TransformerConfigurationException
>>>>>>>>      */
>>>>>>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>>> indentAmount) throws TransformerConfigurationException {
>>>>>>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>>> indentAmount, boolean keepSpace)
>>>>>>>> +            throws TransformerConfigurationException {
>>>>>>>>         StringBuilder sb = new StringBuilder();
>>>>>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>>>>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>>>>>             sb.append("\"");
>>>>>>>>         }
>>>>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>>>> +        if (keepSpace) {
>>>>>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>>>>>> +        } else {
>>>>>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>>>> +        }
>>>>>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>>>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>>>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>>>>         transformer.transform(source, result);
>>>>>>>>     }
>>>>>>>>
>>>>>>>> -    /** Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>
>>>>>>>> -     * using JAXP TrAX.
>>>>>>>> -     * @param node The<code>Node</code>  to serialize
>>>>>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>>>>>> -     * will be omitted from the output
>>>>>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>>>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>>> +    /**
>>>>>>>> +     * Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>  using JAXP TrAX.
>>>>>>>> +     *
>>>>>>>> +     * @param node
>>>>>>>> +     *            The<code>Node</code>  to serialize
>>>>>>>> +     * @param os
>>>>>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>>>>>> +     * @param encoding
>>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>>> +     * @param omitXmlDeclaration
>>>>>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>>>>>> +     * @param keepSpace
>>>>>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>>>>>> +     * @param indent
>>>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>>>> +     * @param indentAmount
>>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>>>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>>>>      * @throws TransformerException
>>>>>>>>      */
>>>>>>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>>>> indent, int indentAmount) throws TransformerException {
>>>>>>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>>>>>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>>>> indent, int indentAmount,
>>>>>>>> +            boolean keepSpace) throws TransformerException {
>>>>>>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>>>>>         transformDomDocument(transformer, node, os);
>>>>>>>>     }
>>>>>>>>
>>>>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>>>>             return;
>>>>>>>>         }
>>>>>>>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>>>>>>> -        // charset = UTF-8, line width = 72
>>>>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>>>>         try {
>>>>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>>>>>>         } catch (TransformerException e) {
>>>>>>>>             // Wrapping this exception for backwards compatibility
>>>>>>>>             throw new IOException(e.getMessage());
>>>>>>>>
>>>>>>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- 
>>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>>>>>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>>>>>>> @@ -8,6 +8,7 @@
>>>>>>>>     to you under the Apache License, Version 2.0 (the
>>>>>>>>     "License"); you may not use this file except in compliance
>>>>>>>>     with the License.  You may obtain a copy of the License at
>>>>>>>> +
>>>>>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>>
>>>>>>>>     Unless required by applicable law or agreed to in writing,
>>>>>>>> @@ -17,13 +18,13 @@
>>>>>>>>     specific language governing permissions and limitations
>>>>>>>>     under the License.
>>>>>>>> -->
>>>>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>>>>> <property key="AP">
>>>>>>>> <value xml:lang="de">Kreditoren</value>
>>>>>>>> <value xml:lang="en">AP</value>
>>>>>>>> <value xml:lang="es">Compras</value>
>>>>>>>> <value xml:lang="fr">Cpt. fourn.</value>
>>>>>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>>>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>>>>> <value xml:lang="it">AP</value>
>>>>>>>> <value xml:lang="nl">Schulden</value>
>>>>>>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>>>>>>> @@ -127,6 +128,7 @@
>>>>>>>> <property key="CommonAbort">
>>>>>>>> <value xml:lang="en">Abort</value>
>>>>>>>> <value xml:lang="es">Cancelar</value>
>>>>>>>> +<value xml:lang="fr">Abandonner</value>
>>>>>>>> <value xml:lang="vi">Hủy</value>
>>>>>>>> </property>
>>>>>>>> <property key="CommonAccepted">
>>>>>>>> @@ -413,6 +415,7 @@
>>>>>>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>>>>> <value xml:lang="en">Address not found.</value>
>>>>>>>> <value xml:lang="es">Dirección no encontrada.</value>
>>>>>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>>>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>>>>> </property>
>>>>>>>> <property key="CommonAddresses">
>>>>>>>> @@ -2770,7 +2773,8 @@
>>>>>>>> <value xml:lang="zh_TW">電子郵件</value>
>>>>>>>> </property>
>>>>>>>> <property key="CommonEmptyHeader">
>>>>>>>> -<value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>>>>>>>> +<!-- do not  remove this! -->
>>>>>>>> +<value xml:lang="en" xml:space="preserve"> </value>
>>>>>>>> </property>
>>>>>>>> <property key="CommonEnable">
>>>>>>>> <value xml:lang="en">Enable</value>
>>>>>>>> @@ -11081,6 +11085,31 @@
>>>>>>>> <value xml:lang="zh">有效日期</value>
>>>>>>>> <value xml:lang="zh_TW">有效日</value>
>>>>>>>> </property>
>>>>>>>> +<property key="FormFieldTitle_expireButton">
>>>>>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>>>>>> +<value xml:lang="cs">Vypršet</value>
>>>>>>>> +<value xml:lang="de">Ablaufen</value>
>>>>>>>> +<value xml:lang="en">Expire</value>
>>>>>>>> +<value xml:lang="es">Expiración</value>
>>>>>>>> +<value xml:lang="fr">Invalider</value>
>>>>>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>>>>>> +<value xml:lang="it">Scade</value>
>>>>>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>>>>>> +<value xml:lang="pt">Expirar</value>
>>>>>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>>>>>> +<value xml:lang="ro">Expira</value>
>>>>>>>> +<value xml:lang="ru">Прекратить</value>
>>>>>>>> +<value xml:lang="th">หมดเขต</value>
>>>>>>>> +<value xml:lang="vi">Hết hạn</value>
>>>>>>>> +<value xml:lang="zh">过期</value>
>>>>>>>> +<value xml:lang="zh-CN">过期</value>
>>>>>>>> +<value xml:lang="zh-TW">過期</value>
>>>>>>>> +</property>
>>>>>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>>>>>> +</property>
>>>>>>>> <property key="FormFieldTitle_externalDeviceId">
>>>>>>>> <value xml:lang="en">External Device Id</value>
>>>>>>>> <value xml:lang="es">Código dispositivo externo</value>
>>>>>>>> @@ -11091,11 +11120,6 @@
>>>>>>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>>>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>>>>>>> </property>
>>>>>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>>>>>> -</property>
>>>>>>>> <property key="FormFieldTitle_fromDate">
>>>>>>>> <value xml:lang="ar">تاريخ البدء</value>
>>>>>>>> <value xml:lang="de">Von Datum</value>
>>>>>>>>
>>>>>>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- 
>>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>>>>>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15
>>>>>>>> 19:11:13 2012
>>>>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>>>>> import org.ofbiz.base.util.UtilXml;
>>>>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>>>>> -
>>>>>>>> import org.ofbiz.service.DispatchContext;
>>>>>>>> import org.ofbiz.service.ServiceUtil;
>>>>>>>> -
>>>>>>>> import org.w3c.dom.Comment;
>>>>>>>> import org.w3c.dom.Document;
>>>>>>>> import org.w3c.dom.Element;
>>>>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>>>>                         if (apacheLicenseText != null) {
>>>>>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>>>>>                         }
>>>>>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>>>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>>>>>                     } finally {
>>>>>>>>                         fos.close();
>>>>>>>>                         // clear cache to see immediately the new labels and
>>>>>>>>
>>>>>>>> 

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adrian Crum <ad...@sandglass-software.com>.
I tried to explain it to you in the Jira issue and in my initial 
response to this commit. Clearly, you are not understanding the problem. 
If you don't understand the problem, then you shouldn't be committing 
half-baked "solutions."

I will try to explain it again:

1. CommonEmptyHeader exists as a workaround to a flaw in the screen 
widget rendering. The simple fact that a single space character - which 
never needs to be translated - is in the UI label file makes it obvious 
that it is a hack.

2. Label Manager removes the single space from CommonEmptyHeader  while 
saving changes to the file. That is because a stylesheet is used to 
format the XML, and the stylesheet removes the space.

3. The correct solution to this problem (#2) is to fix the screen widget 
rendering (#1).

4. Disabling space removal in the stylesheet effectively disables the 
entire stylesheet. The whole point of the method you modified is to 
strip all spaces from the XML, and then indent the XML with the 
specified spacing. If you turn off the space removal then the XML will 
not be indented properly.

I can't make it any simpler than that.

In case you missed it in my previous replies:

-1 on this commit and the others like it.

If you can't understand the problem, then that's fine - revert the code 
and unassign yourself from the Jira issue so someone more qualified can 
fix it.

-Adrian

On 5/16/2012 9:05 AM, Jacques Le Roux wrote:
> Why don't you answer on my proposition? Why don't you *clearly 
> explain* why this change is unnecessary instead of yelling?
>
> I really want to fix this bug, wich removes the xml:space="preserve" 
> attribute from CommonEmptyHeader
>
> Jacques
>
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> I repeat: THIS CHANGE IS UNNECESSARY.
>>
>> Please revert it.
>>
>> And in case you missed it the first time:
>>
>> -1 on this commit and the others like it.
>>
>> -Adrian
>>
>> On 5/16/2012 8:28 AM, Jacques Le Roux wrote:
>>> I don't agree, it does not hide a problem, it solves a problem.
>>>
>>> The (keepSpace=true) version  is only used in 
>>> SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed 
>>> functionally.
>>>
>>> Would you not agree with this patch?
>>>
>>> Index: 
>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>> ===================================================================
>>> --- 
>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>> (revision 1338984)
>>> +++ 
>>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>> (working copy)
>>> @@ -113,6 +113,7 @@
>>>                 resourceElem.setAttribute("xmlns:xsi", 
>>> "http://www.w3.org/2001/XMLSchema-instance");
>>>                 
>>> resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
>>>                 for (String labelKey : labelsList) {
>>> +                    boolean keepSpaces = false;
>>>                     LabelInfo labelInfo = labels.get(labelKey);
>>>                     if 
>>> (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
>>>                         continue;
>>> @@ -136,6 +137,7 @@
>>>                             valueElem.setAttribute("xml:lang", 
>>> localeFound);
>>>                             if (valueString.trim().isEmpty()) {
>>>                                 valueElem.setAttribute("xml:space", 
>>> "preserve");
>>> +                                keepSpaces = true;
>>>                             }
>>>                             if 
>>> (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
>>>                                 Comment labelComment =
>>> resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment())); 
>>>
>>> @@ -149,7 +151,7 @@
>>>                         if (apacheLicenseText != null) {
>>>                             fos.write(apacheLicenseText.getBytes());
>>>                         }
>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, 
>>> "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, 
>>> "UTF-8", !(apacheLicenseText == null), true, 4, keepSpaces);
>>>                     } finally {
>>>                         fos.close();
>>>                         // clear cache to see immediately the new 
>>> labels and
>>>
>>> Jacques
>>>
>>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>>> The bad thing about this change is that it is not necessary. This 
>>>> change hides a problem - it does not solve it. I mentioned that
>>>> in the Jira issue.
>>>>
>>>> The method is supposed to pretty-print an XML document, and if you 
>>>> turn off space removal, the indentation will be wrong. In other
>>>> words, it will not be pretty.
>>>>
>>>> -1 on this change in any version.
>>>>
>>>> -Adrian
>>>>
>>>> On 5/16/2012 2:25 AM, Scott Gray wrote:
>>>>> I see in your subsequent commits that you encountered the problems 
>>>>> caused by this type of change.
>>>>>
>>>>> They're also a pretty good indication that once again you didn't 
>>>>> compile or test before back-porting, I'm not sure what I can do
>>>>> to make the need for this any clearer to you.  Please remember 
>>>>> your responsibilities as a committer.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>>>>
>>>>>> You've changed the signature on the UtilXml methods, that should 
>>>>>> not be done and especially not be back-ported to the branches.
>>>>>> Even in the trunk the correct thing to do is to add a new method 
>>>>>> with the new signature and then (if needed) deprecate the old
>>>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>>>
>>>>>> There's nothing new in this comment Jacques, the general rule of 
>>>>>> thumb is never change a method signature unless it is private.
>>>>>>
>>>>>> Regards
>>>>>> Scott
>>>>>>
>>>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>>>
>>>>>>> Author: jleroux
>>>>>>> Date: Tue May 15 19:11:13 2012
>>>>>>> New Revision: 1338836
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>>>> Log:
>>>>>>> "Applied fix from trunk for revision: 1338831" (conflict in 
>>>>>>> CommonUiLabels.xml handled by hand)
>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>
>>>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 
>>>>>>> 2012) | 14 lines
>>>>>>>
>>>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The 
>>>>>>> Label Manager is wrongly overriding CommonEmptyHeader"
>>>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this 
>>>>>>> allows to use xsl:preserve-space into
>>>>>>> UtilXml.createOutputTransformer()
>>>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>>>> * Adds some French labels into CommonUiLabels.xml using Labels 
>>>>>>> Manager to test the new functionality
>>>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>>>
>>>>>>> I got an issue when 1st trying to commit:
>>>>>>> Commit failed (details follow):
>>>>>>> While preparing
>>>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' 
>>>>>>> for commit
>>>>>>> Inconsistent line ending style
>>>>>>>
>>>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>
>>>>>>> 
>>>>>>>
>>>>>>> Modified:
>>>>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>>    
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>>>    
>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>>    
>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>
>>>>>>>    
>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>>
>>>>>>> Propchange: ofbiz/branches/release12.04/
>>>>>>> ------------------------------------------------------------------------------ 
>>>>>>>
>>>>>>> Merged /ofbiz/trunk:r1338831
>>>>>>>
>>>>>>> Modified: 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>
>>>>>>> ============================================================================== 
>>>>>>>
>>>>>>> --- 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml 
>>>>>>> (original)
>>>>>>> +++ 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml 
>>>>>>> Tue May 15 19:11:13 2012
>>>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>>>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" 
>>>>>>> uri="jndi-config.xsd"/>
>>>>>>> <system 
>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" 
>>>>>>> uri="ofbiz-component.xsd"/>
>>>>>>> <system 
>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" 
>>>>>>> uri="ofbiz-containers.xsd"/>
>>>>>>> +<system 
>>>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" 
>>>>>>> uri="ofbiz-properties.xsd"/>
>>>>>>> </catalog>
>>>>>>>
>>>>>>> Modified: 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>
>>>>>>> ============================================================================== 
>>>>>>>
>>>>>>> --- 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>> (original)
>>>>>>> +++ 
>>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd 
>>>>>>> Tue May 15 19:11:13 2012
>>>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>>>> <xs:simpleContent>
>>>>>>> <xs:extension base="xs:string">
>>>>>>> <xs:attribute ref="xml:lang"/>
>>>>>>> +<xs:attribute ref="xml:space"/>
>>>>>>> </xs:extension>
>>>>>>> </xs:simpleContent>
>>>>>>> </xs:complexType>
>>>>>>>
>>>>>>> Modified: 
>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>
>>>>>>> ============================================================================== 
>>>>>>>
>>>>>>> --- 
>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>>>> (original)
>>>>>>> +++ 
>>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>>>> Tue May 15 19:11:13 2012
>>>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>>>
>>>>>>>     // ----- TrAX Methods ----------------- //
>>>>>>>
>>>>>>> -    /** Creates a JAXP TrAX Transformer suitable for 
>>>>>>> pretty-printing an
>>>>>>> -     * XML document. This method is provided as an alternative 
>>>>>>> to the
>>>>>>> -     * 
>>>>>>> deprecated<code>org.apache.xml.serialize.OutputFormat</code>  
>>>>>>> class.
>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>>>> declaration
>>>>>>> -     * will be omitted from the output
>>>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>>>> indented
>>>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>>>> is<code>true</code>,
>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>> +    /**
>>>>>>> +     * Creates a JAXP TrAX Transformer suitable for 
>>>>>>> pretty-printing an XML document. This method is provided as an 
>>>>>>> alternative
>>>>>>> to the deprecated
>>>>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>>> +     *
>>>>>>> +     * @param encoding
>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>> +     * @param omitXmlDeclaration
>>>>>>> +     *            If<code>true</code>  the xml declaration will 
>>>>>>> be omitted from the output
>>>>>>> +     * @param indent
>>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>>> +     * @param indentAmount
>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, 
>>>>>>> the number of spaces to indent. Default is 4.
>>>>>>> +     * @param keepSpace
>>>>>>> +     *            If<code>true</code>  spaces are preserved, 
>>>>>>> else striped
>>>>>>>      * @return A<code>Transformer</code>  instance
>>>>>>>      * @see<a 
>>>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>>>> TrAX</a>
>>>>>>>      * @throws TransformerConfigurationException
>>>>>>>      */
>>>>>>> -    public static Transformer createOutputTransformer(String 
>>>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>> indentAmount) throws TransformerConfigurationException {
>>>>>>> +    public static Transformer createOutputTransformer(String 
>>>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>>> indentAmount, boolean keepSpace)
>>>>>>> +            throws TransformerConfigurationException {
>>>>>>>         StringBuilder sb = new StringBuilder();
>>>>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>>>>         sb.append("<xsl:stylesheet 
>>>>>>> xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>>>>             sb.append("\"");
>>>>>>>         }
>>>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>>> +        if (keepSpace) {
>>>>>>> +            sb.append("/>\n<xsl:preserve-space 
>>>>>>> elements=\"*\"/>\n");
>>>>>>> +        } else {
>>>>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>>> +        }
>>>>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>>>         sb.append("<xsl:copy><xsl:apply-templates 
>>>>>>> select=\"@*|node()\"/></xsl:copy>\n");
>>>>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>>>         transformer.transform(source, result);
>>>>>>>     }
>>>>>>>
>>>>>>> -    /** Serializes a DOM<code>Node</code>  to 
>>>>>>> an<code>OutputStream</code>
>>>>>>> -     * using JAXP TrAX.
>>>>>>> -     * @param node The<code>Node</code>  to serialize
>>>>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>>>> declaration
>>>>>>> -     * will be omitted from the output
>>>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>>>> indented
>>>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>>>> is<code>true</code>,
>>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>>> +    /**
>>>>>>> +     * Serializes a DOM<code>Node</code>  to 
>>>>>>> an<code>OutputStream</code>  using JAXP TrAX.
>>>>>>> +     *
>>>>>>> +     * @param node
>>>>>>> +     *            The<code>Node</code>  to serialize
>>>>>>> +     * @param os
>>>>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>>>>> +     * @param encoding
>>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>>> +     * @param omitXmlDeclaration
>>>>>>> +     *            If<code>true</code>  the xml declaration will 
>>>>>>> be omitted from the output
>>>>>>> +     * @param keepSpace
>>>>>>> +     *            If<code>true</code>  spaces are preserved, 
>>>>>>> else striped
>>>>>>> +     * @param indent
>>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>>> +     * @param indentAmount
>>>>>>> +     *            If<code>indent</code>  is<code>true</code>, 
>>>>>>> the number of spaces to indent. Default is 4.
>>>>>>>      * @see<a 
>>>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>>>> TrAX</a>
>>>>>>>      * @throws TransformerException
>>>>>>>      */
>>>>>>> -    public static void writeXmlDocument(Node node, OutputStream 
>>>>>>> os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>>> indent, int indentAmount) throws TransformerException {
>>>>>>> -        Transformer transformer = 
>>>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>>>> indentAmount);
>>>>>>> +    public static void writeXmlDocument(Node node, OutputStream 
>>>>>>> os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>>> indent, int indentAmount,
>>>>>>> +            boolean keepSpace) throws TransformerException {
>>>>>>> +        Transformer transformer = 
>>>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>>>> indentAmount, keepSpace);
>>>>>>>         transformDomDocument(transformer, node, os);
>>>>>>>     }
>>>>>>>
>>>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>>>             return;
>>>>>>>         }
>>>>>>>         // OutputFormat defaults are: indent on, indent = 4, 
>>>>>>> include XML declaration,
>>>>>>> -        // charset = UTF-8, line width = 72
>>>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>>>         try {
>>>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, 
>>>>>>> false);
>>>>>>>         } catch (TransformerException e) {
>>>>>>>             // Wrapping this exception for backwards compatibility
>>>>>>>             throw new IOException(e.getMessage());
>>>>>>>
>>>>>>> Modified: 
>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>>
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>
>>>>>>> ============================================================================== 
>>>>>>>
>>>>>>> --- 
>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>> (original)
>>>>>>> +++ 
>>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>>> Tue May 15 19:11:13 2012
>>>>>>> @@ -8,6 +8,7 @@
>>>>>>>     to you under the Apache License, Version 2.0 (the
>>>>>>>     "License"); you may not use this file except in compliance
>>>>>>>     with the License.  You may obtain a copy of the License at
>>>>>>> +
>>>>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>
>>>>>>>     Unless required by applicable law or agreed to in writing,
>>>>>>> @@ -17,13 +18,13 @@
>>>>>>>     specific language governing permissions and limitations
>>>>>>>     under the License.
>>>>>>> -->
>>>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd"> 
>>>>>>>
>>>>>>> <property key="AP">
>>>>>>> <value xml:lang="de">Kreditoren</value>
>>>>>>> <value xml:lang="en">AP</value>
>>>>>>> <value xml:lang="es">Compras</value>
>>>>>>> <value xml:lang="fr">Cpt. fourn.</value>
>>>>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>>>> <value xml:lang="it">AP</value>
>>>>>>> <value xml:lang="nl">Schulden</value>
>>>>>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>>>>>> @@ -127,6 +128,7 @@
>>>>>>> <property key="CommonAbort">
>>>>>>> <value xml:lang="en">Abort</value>
>>>>>>> <value xml:lang="es">Cancelar</value>
>>>>>>> +<value xml:lang="fr">Abandonner</value>
>>>>>>> <value xml:lang="vi">Hủy</value>
>>>>>>> </property>
>>>>>>> <property key="CommonAccepted">
>>>>>>> @@ -413,6 +415,7 @@
>>>>>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>>>> <value xml:lang="en">Address not found.</value>
>>>>>>> <value xml:lang="es">Dirección no encontrada.</value>
>>>>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>>>> </property>
>>>>>>> <property key="CommonAddresses">
>>>>>>> @@ -2770,7 +2773,8 @@
>>>>>>> <value xml:lang="zh_TW">電子郵件</value>
>>>>>>> </property>
>>>>>>> <property key="CommonEmptyHeader">
>>>>>>> -<value xml:lang="en" xml:space="preserve"> </value><!-- do not  
>>>>>>> remove this! -->
>>>>>>> +<!-- do not  remove this! -->
>>>>>>> +<value xml:lang="en" xml:space="preserve"> </value>
>>>>>>> </property>
>>>>>>> <property key="CommonEnable">
>>>>>>> <value xml:lang="en">Enable</value>
>>>>>>> @@ -11081,6 +11085,31 @@
>>>>>>> <value xml:lang="zh">有效日期</value>
>>>>>>> <value xml:lang="zh_TW">有效日</value>
>>>>>>> </property>
>>>>>>> +<property key="FormFieldTitle_expireButton">
>>>>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>>>>> +<value xml:lang="cs">Vypršet</value>
>>>>>>> +<value xml:lang="de">Ablaufen</value>
>>>>>>> +<value xml:lang="en">Expire</value>
>>>>>>> +<value xml:lang="es">Expiración</value>
>>>>>>> +<value xml:lang="fr">Invalider</value>
>>>>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>>>>> +<value xml:lang="it">Scade</value>
>>>>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>>>>> +<value xml:lang="pt">Expirar</value>
>>>>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>>>>> +<value xml:lang="ro">Expira</value>
>>>>>>> +<value xml:lang="ru">Прекратить</value>
>>>>>>> +<value xml:lang="th">หมดเขต</value>
>>>>>>> +<value xml:lang="vi">Hết hạn</value>
>>>>>>> +<value xml:lang="zh">过期</value>
>>>>>>> +<value xml:lang="zh-CN">过期</value>
>>>>>>> +<value xml:lang="zh-TW">過期</value>
>>>>>>> +</property>
>>>>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>>>>> +</property>
>>>>>>> <property key="FormFieldTitle_externalDeviceId">
>>>>>>> <value xml:lang="en">External Device Id</value>
>>>>>>> <value xml:lang="es">Código dispositivo externo</value>
>>>>>>> @@ -11091,11 +11120,6 @@
>>>>>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>>>>>> </property>
>>>>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>>>>> -</property>
>>>>>>> <property key="FormFieldTitle_fromDate">
>>>>>>> <value xml:lang="ar">تاريخ البدء</value>
>>>>>>> <value xml:lang="de">Von Datum</value>
>>>>>>>
>>>>>>> Modified: 
>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>>>
>>>>>>> ============================================================================== 
>>>>>>>
>>>>>>> --- 
>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>>>> (original)
>>>>>>> +++ 
>>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>>>> Tue May 15
>>>>>>> 19:11:13 2012
>>>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>>>> import org.ofbiz.base.util.UtilXml;
>>>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>>>> -
>>>>>>> import org.ofbiz.service.DispatchContext;
>>>>>>> import org.ofbiz.service.ServiceUtil;
>>>>>>> -
>>>>>>> import org.w3c.dom.Comment;
>>>>>>> import org.w3c.dom.Document;
>>>>>>> import org.w3c.dom.Element;
>>>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>>>                         if (apacheLicenseText != null) {
>>>>>>>                             
>>>>>>> fos.write(apacheLicenseText.getBytes());
>>>>>>>                         }
>>>>>>> -                        UtilXml.writeXmlDocument(resourceElem, 
>>>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>>>>> +                        UtilXml.writeXmlDocument(resourceElem, 
>>>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>>>>                     } finally {
>>>>>>>                         fos.close();
>>>>>>>                         // clear cache to see immediately the 
>>>>>>> new labels and
>>>>>>>
>>>>>>>

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Why don't you answer on my proposition? Why don't you *clearly explain* why this change is unnecessary instead of yelling?

I really want to fix this bug, wich removes the xml:space="preserve" attribute from CommonEmptyHeader

Jacques

From: "Adrian Crum" <ad...@sandglass-software.com>
>I repeat: THIS CHANGE IS UNNECESSARY.
>
> Please revert it.
>
> And in case you missed it the first time:
>
> -1 on this commit and the others like it.
>
> -Adrian
>
> On 5/16/2012 8:28 AM, Jacques Le Roux wrote:
>> I don't agree, it does not hide a problem, it solves a problem.
>>
>> The (keepSpace=true) version  is only used in SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed functionally.
>>
>> Would you not agree with this patch?
>>
>> Index: framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> ===================================================================
>> --- 
>> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (revision 1338984)
>> +++ framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (working copy)
>> @@ -113,6 +113,7 @@
>>                 resourceElem.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
>>                 resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
>>                 for (String labelKey : labelsList) {
>> +                    boolean keepSpaces = false;
>>                     LabelInfo labelInfo = labels.get(labelKey);
>>                     if (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
>>                         continue;
>> @@ -136,6 +137,7 @@
>>                             valueElem.setAttribute("xml:lang", localeFound);
>>                             if (valueString.trim().isEmpty()) {
>>                                 valueElem.setAttribute("xml:space", "preserve");
>> +                                keepSpaces = true;
>>                             }
>>                             if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
>>                                 Comment labelComment =
>> resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment()));
>> @@ -149,7 +151,7 @@
>>                         if (apacheLicenseText != null) {
>>                             fos.write(apacheLicenseText.getBytes());
>>                         }
>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, keepSpaces);
>>                     } finally {
>>                         fos.close();
>>                         // clear cache to see immediately the new labels and
>>
>> Jacques
>>
>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>> The bad thing about this change is that it is not necessary. This change hides a problem - it does not solve it. I mentioned 
>>> that
>>> in the Jira issue.
>>>
>>> The method is supposed to pretty-print an XML document, and if you turn off space removal, the indentation will be wrong. In 
>>> other
>>> words, it will not be pretty.
>>>
>>> -1 on this change in any version.
>>>
>>> -Adrian
>>>
>>> On 5/16/2012 2:25 AM, Scott Gray wrote:
>>>> I see in your subsequent commits that you encountered the problems caused by this type of change.
>>>>
>>>> They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can 
>>>> do
>>>> to make the need for this any clearer to you.  Please remember your responsibilities as a committer.
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>>>
>>>>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the 
>>>>> branches.
>>>>> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old
>>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>>
>>>>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is 
>>>>> private.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>>
>>>>>> Author: jleroux
>>>>>> Date: Tue May 15 19:11:13 2012
>>>>>> New Revision: 1338836
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>>> Log:
>>>>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>>>>> ------------------------------------------------------------------------ 
>>>>>>
>>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>>>>
>>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into
>>>>>> UtilXml.createOutputTransformer()
>>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>>
>>>>>> I got an issue when 1st trying to commit:
>>>>>> Commit failed (details follow):
>>>>>> While preparing
>>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>>>>> Inconsistent line ending style
>>>>>>
>>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>>> ------------------------------------------------------------------------ 
>>>>>>
>>>>>> 
>>>>>>
>>>>>> Modified:
>>>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>>
>>>>>> Propchange: ofbiz/branches/release12.04/
>>>>>> ------------------------------------------------------------------------------ 
>>>>>>
>>>>>> Merged /ofbiz/trunk:r1338831
>>>>>>
>>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>> URL:
>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>> ==============================================================================
>>>>>> --- 
>>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>>>>> +<system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>>>>> </catalog>
>>>>>>
>>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>> URL:
>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>> ==============================================================================
>>>>>> --- 
>>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>>> <xs:simpleContent>
>>>>>> <xs:extension base="xs:string">
>>>>>> <xs:attribute ref="xml:lang"/>
>>>>>> +<xs:attribute ref="xml:space"/>
>>>>>> </xs:extension>
>>>>>> </xs:simpleContent>
>>>>>> </xs:complexType>
>>>>>>
>>>>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>> URL:
>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>> ==============================================================================
>>>>>> --- 
>>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>>>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>>
>>>>>>     // ----- TrAX Methods ----------------- //
>>>>>>
>>>>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>>>>> -     * XML document. This method is provided as an alternative to the
>>>>>> -     * deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>>>> -     * will be omitted from the output
>>>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>> +    /**
>>>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an 
>>>>>> alternative
>>>>>> to the deprecated
>>>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>>> +     *
>>>>>> +     * @param encoding
>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>> +     * @param omitXmlDeclaration
>>>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>>>> +     * @param indent
>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>> +     * @param indentAmount
>>>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>>>> +     * @param keepSpace
>>>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>>>>      * @return A<code>Transformer</code>  instance
>>>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>>      * @throws TransformerConfigurationException
>>>>>>      */
>>>>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>> indentAmount) throws TransformerConfigurationException {
>>>>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>>> indentAmount, boolean keepSpace)
>>>>>> +            throws TransformerConfigurationException {
>>>>>>         StringBuilder sb = new StringBuilder();
>>>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>>>             sb.append("\"");
>>>>>>         }
>>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>> +        if (keepSpace) {
>>>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>>>> +        } else {
>>>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>>> +        }
>>>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>>         transformer.transform(source, result);
>>>>>>     }
>>>>>>
>>>>>> -    /** Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>
>>>>>> -     * using JAXP TrAX.
>>>>>> -     * @param node The<code>Node</code>  to serialize
>>>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>>>> -     * will be omitted from the output
>>>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>>>> -     * the number of spaces to indent. Default is 4.
>>>>>> +    /**
>>>>>> +     * Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>  using JAXP TrAX.
>>>>>> +     *
>>>>>> +     * @param node
>>>>>> +     *            The<code>Node</code>  to serialize
>>>>>> +     * @param os
>>>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>>>> +     * @param encoding
>>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>>> +     * @param omitXmlDeclaration
>>>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>>>> +     * @param keepSpace
>>>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>>>> +     * @param indent
>>>>>> +     *            If<code>true</code>, the output will be indented
>>>>>> +     * @param indentAmount
>>>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>>      * @throws TransformerException
>>>>>>      */
>>>>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>> indent, int indentAmount) throws TransformerException {
>>>>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>>>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>>>> indent, int indentAmount,
>>>>>> +            boolean keepSpace) throws TransformerException {
>>>>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>>>         transformDomDocument(transformer, node, os);
>>>>>>     }
>>>>>>
>>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>>             return;
>>>>>>         }
>>>>>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>>>>> -        // charset = UTF-8, line width = 72
>>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>>         try {
>>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>>>>         } catch (TransformerException e) {
>>>>>>             // Wrapping this exception for backwards compatibility
>>>>>>             throw new IOException(e.getMessage());
>>>>>>
>>>>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>>> URL:
>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>> ==============================================================================
>>>>>> --- 
>>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>>>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>>>>> @@ -8,6 +8,7 @@
>>>>>>     to you under the Apache License, Version 2.0 (the
>>>>>>     "License"); you may not use this file except in compliance
>>>>>>     with the License.  You may obtain a copy of the License at
>>>>>> +
>>>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>>>
>>>>>>     Unless required by applicable law or agreed to in writing,
>>>>>> @@ -17,13 +18,13 @@
>>>>>>     specific language governing permissions and limitations
>>>>>>     under the License.
>>>>>> -->
>>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>>> <property key="AP">
>>>>>> <value xml:lang="de">Kreditoren</value>
>>>>>> <value xml:lang="en">AP</value>
>>>>>> <value xml:lang="es">Compras</value>
>>>>>> <value xml:lang="fr">Cpt. fourn.</value>
>>>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>>> <value xml:lang="it">AP</value>
>>>>>> <value xml:lang="nl">Schulden</value>
>>>>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>>>>> @@ -127,6 +128,7 @@
>>>>>> <property key="CommonAbort">
>>>>>> <value xml:lang="en">Abort</value>
>>>>>> <value xml:lang="es">Cancelar</value>
>>>>>> +<value xml:lang="fr">Abandonner</value>
>>>>>> <value xml:lang="vi">Hủy</value>
>>>>>> </property>
>>>>>> <property key="CommonAccepted">
>>>>>> @@ -413,6 +415,7 @@
>>>>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>>> <value xml:lang="en">Address not found.</value>
>>>>>> <value xml:lang="es">Dirección no encontrada.</value>
>>>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>>> </property>
>>>>>> <property key="CommonAddresses">
>>>>>> @@ -2770,7 +2773,8 @@
>>>>>> <value xml:lang="zh_TW">電子郵件</value>
>>>>>> </property>
>>>>>> <property key="CommonEmptyHeader">
>>>>>> -<value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>>>>>> +<!-- do not  remove this! -->
>>>>>> +<value xml:lang="en" xml:space="preserve"> </value>
>>>>>> </property>
>>>>>> <property key="CommonEnable">
>>>>>> <value xml:lang="en">Enable</value>
>>>>>> @@ -11081,6 +11085,31 @@
>>>>>> <value xml:lang="zh">有效日期</value>
>>>>>> <value xml:lang="zh_TW">有效日</value>
>>>>>> </property>
>>>>>> +<property key="FormFieldTitle_expireButton">
>>>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>>>> +<value xml:lang="cs">Vypršet</value>
>>>>>> +<value xml:lang="de">Ablaufen</value>
>>>>>> +<value xml:lang="en">Expire</value>
>>>>>> +<value xml:lang="es">Expiración</value>
>>>>>> +<value xml:lang="fr">Invalider</value>
>>>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>>>> +<value xml:lang="it">Scade</value>
>>>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>>>> +<value xml:lang="pt">Expirar</value>
>>>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>>>> +<value xml:lang="ro">Expira</value>
>>>>>> +<value xml:lang="ru">Прекратить</value>
>>>>>> +<value xml:lang="th">หมดเขต</value>
>>>>>> +<value xml:lang="vi">Hết hạn</value>
>>>>>> +<value xml:lang="zh">过期</value>
>>>>>> +<value xml:lang="zh-CN">过期</value>
>>>>>> +<value xml:lang="zh-TW">過期</value>
>>>>>> +</property>
>>>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>>>> +</property>
>>>>>> <property key="FormFieldTitle_externalDeviceId">
>>>>>> <value xml:lang="en">External Device Id</value>
>>>>>> <value xml:lang="es">Código dispositivo externo</value>
>>>>>> @@ -11091,11 +11120,6 @@
>>>>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>>>>> </property>
>>>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>>>> -</property>
>>>>>> <property key="FormFieldTitle_fromDate">
>>>>>> <value xml:lang="ar">تاريخ البدء</value>
>>>>>> <value xml:lang="de">Von Datum</value>
>>>>>>
>>>>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>> URL:
>>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>>> ==============================================================================
>>>>>> --- 
>>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>>>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15
>>>>>> 19:11:13 2012
>>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>>> import org.ofbiz.base.util.UtilXml;
>>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>>> -
>>>>>> import org.ofbiz.service.DispatchContext;
>>>>>> import org.ofbiz.service.ServiceUtil;
>>>>>> -
>>>>>> import org.w3c.dom.Comment;
>>>>>> import org.w3c.dom.Document;
>>>>>> import org.w3c.dom.Element;
>>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>>                         if (apacheLicenseText != null) {
>>>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>>>                         }
>>>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>>>                     } finally {
>>>>>>                         fos.close();
>>>>>>                         // clear cache to see immediately the new labels and
>>>>>>
>>>>>> 

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adrian Crum <ad...@sandglass-software.com>.
I repeat: THIS CHANGE IS UNNECESSARY.

Please revert it.

And in case you missed it the first time:

-1 on this commit and the others like it.

-Adrian

On 5/16/2012 8:28 AM, Jacques Le Roux wrote:
> I don't agree, it does not hide a problem, it solves a problem.
>
> The (keepSpace=true) version  is only used in 
> SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed 
> functionally.
>
> Would you not agree with this patch?
>
> Index: 
> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> ===================================================================
> --- 
> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
> (revision 1338984)
> +++ 
> framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
> (working copy)
> @@ -113,6 +113,7 @@
>                 resourceElem.setAttribute("xmlns:xsi", 
> "http://www.w3.org/2001/XMLSchema-instance");
>                 
> resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
>                 for (String labelKey : labelsList) {
> +                    boolean keepSpaces = false;
>                     LabelInfo labelInfo = labels.get(labelKey);
>                     if 
> (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
>                         continue;
> @@ -136,6 +137,7 @@
>                             valueElem.setAttribute("xml:lang", 
> localeFound);
>                             if (valueString.trim().isEmpty()) {
>                                 valueElem.setAttribute("xml:space", 
> "preserve");
> +                                keepSpaces = true;
>                             }
>                             if 
> (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
>                                 Comment labelComment =
> resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment())); 
>
> @@ -149,7 +151,7 @@
>                         if (apacheLicenseText != null) {
>                             fos.write(apacheLicenseText.getBytes());
>                         }
> -                        UtilXml.writeXmlDocument(resourceElem, fos, 
> "UTF-8", !(apacheLicenseText == null), true, 4, true);
> +                        UtilXml.writeXmlDocument(resourceElem, fos, 
> "UTF-8", !(apacheLicenseText == null), true, 4, keepSpaces);
>                     } finally {
>                         fos.close();
>                         // clear cache to see immediately the new 
> labels and
>
> Jacques
>
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> The bad thing about this change is that it is not necessary. This 
>> change hides a problem - it does not solve it. I mentioned that
>> in the Jira issue.
>>
>> The method is supposed to pretty-print an XML document, and if you 
>> turn off space removal, the indentation will be wrong. In other
>> words, it will not be pretty.
>>
>> -1 on this change in any version.
>>
>> -Adrian
>>
>> On 5/16/2012 2:25 AM, Scott Gray wrote:
>>> I see in your subsequent commits that you encountered the problems 
>>> caused by this type of change.
>>>
>>> They're also a pretty good indication that once again you didn't 
>>> compile or test before back-porting, I'm not sure what I can do
>>> to make the need for this any clearer to you.  Please remember your 
>>> responsibilities as a committer.
>>>
>>> Regards
>>> Scott
>>>
>>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>>
>>>> You've changed the signature on the UtilXml methods, that should 
>>>> not be done and especially not be back-ported to the branches.
>>>> Even in the trunk the correct thing to do is to add a new method 
>>>> with the new signature and then (if needed) deprecate the old
>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>
>>>> There's nothing new in this comment Jacques, the general rule of 
>>>> thumb is never change a method signature unless it is private.
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>
>>>>> Author: jleroux
>>>>> Date: Tue May 15 19:11:13 2012
>>>>> New Revision: 1338836
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>> Log:
>>>>> "Applied fix from trunk for revision: 1338831" (conflict in 
>>>>> CommonUiLabels.xml handled by hand)
>>>>> ------------------------------------------------------------------------ 
>>>>>
>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) 
>>>>> | 14 lines
>>>>>
>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label 
>>>>> Manager is wrongly overriding CommonEmptyHeader"
>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this 
>>>>> allows to use xsl:preserve-space into
>>>>> UtilXml.createOutputTransformer()
>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>> * Adds some French labels into CommonUiLabels.xml using Labels 
>>>>> Manager to test the new functionality
>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>
>>>>> I got an issue when 1st trying to commit:
>>>>> Commit failed (details follow):
>>>>> While preparing
>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' 
>>>>> for commit
>>>>> Inconsistent line ending style
>>>>>
>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>> ------------------------------------------------------------------------ 
>>>>>
>>>>> 
>>>>>
>>>>> Modified:
>>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>    
>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>    
>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>    
>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>
>>>>>    
>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>
>>>>> Propchange: ofbiz/branches/release12.04/
>>>>> ------------------------------------------------------------------------------ 
>>>>>
>>>>> Merged /ofbiz/trunk:r1338831
>>>>>
>>>>> Modified: 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml 
>>>>> (original)
>>>>> +++ 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml 
>>>>> Tue May 15 19:11:13 2012
>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" 
>>>>> uri="jndi-config.xsd"/>
>>>>> <system 
>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" 
>>>>> uri="ofbiz-component.xsd"/>
>>>>> <system 
>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" 
>>>>> uri="ofbiz-containers.xsd"/>
>>>>> +<system 
>>>>> systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" 
>>>>> uri="ofbiz-properties.xsd"/>
>>>>> </catalog>
>>>>>
>>>>> Modified: 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original) 
>>>>>
>>>>> +++ 
>>>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue 
>>>>> May 15 19:11:13 2012
>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>> <xs:simpleContent>
>>>>> <xs:extension base="xs:string">
>>>>> <xs:attribute ref="xml:lang"/>
>>>>> +<xs:attribute ref="xml:space"/>
>>>>> </xs:extension>
>>>>> </xs:simpleContent>
>>>>> </xs:complexType>
>>>>>
>>>>> Modified: 
>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>> (original)
>>>>> +++ 
>>>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java 
>>>>> Tue May 15 19:11:13 2012
>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>
>>>>>     // ----- TrAX Methods ----------------- //
>>>>>
>>>>> -    /** Creates a JAXP TrAX Transformer suitable for 
>>>>> pretty-printing an
>>>>> -     * XML document. This method is provided as an alternative to 
>>>>> the
>>>>> -     * 
>>>>> deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>> declaration
>>>>> -     * will be omitted from the output
>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>> indented
>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>> is<code>true</code>,
>>>>> -     * the number of spaces to indent. Default is 4.
>>>>> +    /**
>>>>> +     * Creates a JAXP TrAX Transformer suitable for 
>>>>> pretty-printing an XML document. This method is provided as an 
>>>>> alternative
>>>>> to the deprecated
>>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>>> +     *
>>>>> +     * @param encoding
>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>> +     * @param omitXmlDeclaration
>>>>> +     *            If<code>true</code>  the xml declaration will 
>>>>> be omitted from the output
>>>>> +     * @param indent
>>>>> +     *            If<code>true</code>, the output will be indented
>>>>> +     * @param indentAmount
>>>>> +     *            If<code>indent</code>  is<code>true</code>, the 
>>>>> number of spaces to indent. Default is 4.
>>>>> +     * @param keepSpace
>>>>> +     *            If<code>true</code>  spaces are preserved, else 
>>>>> striped
>>>>>      * @return A<code>Transformer</code>  instance
>>>>>      * @see<a 
>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>> TrAX</a>
>>>>>      * @throws TransformerConfigurationException
>>>>>      */
>>>>> -    public static Transformer createOutputTransformer(String 
>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>> indentAmount) throws TransformerConfigurationException {
>>>>> +    public static Transformer createOutputTransformer(String 
>>>>> encoding, boolean omitXmlDeclaration, boolean indent, int
>>>>> indentAmount, boolean keepSpace)
>>>>> +            throws TransformerConfigurationException {
>>>>>         StringBuilder sb = new StringBuilder();
>>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>>         sb.append("<xsl:stylesheet 
>>>>> xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>>             sb.append("\"");
>>>>>         }
>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>> +        if (keepSpace) {
>>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>>> +        } else {
>>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>> +        }
>>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>         sb.append("<xsl:copy><xsl:apply-templates 
>>>>> select=\"@*|node()\"/></xsl:copy>\n");
>>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>         transformer.transform(source, result);
>>>>>     }
>>>>>
>>>>> -    /** Serializes a DOM<code>Node</code>  to 
>>>>> an<code>OutputStream</code>
>>>>> -     * using JAXP TrAX.
>>>>> -     * @param node The<code>Node</code>  to serialize
>>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml 
>>>>> declaration
>>>>> -     * will be omitted from the output
>>>>> -     * @param indent If<code>true</code>, the output will be 
>>>>> indented
>>>>> -     * @param indentAmount If<code>indent</code>  
>>>>> is<code>true</code>,
>>>>> -     * the number of spaces to indent. Default is 4.
>>>>> +    /**
>>>>> +     * Serializes a DOM<code>Node</code>  to 
>>>>> an<code>OutputStream</code>  using JAXP TrAX.
>>>>> +     *
>>>>> +     * @param node
>>>>> +     *            The<code>Node</code>  to serialize
>>>>> +     * @param os
>>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>>> +     * @param encoding
>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>> +     * @param omitXmlDeclaration
>>>>> +     *            If<code>true</code>  the xml declaration will 
>>>>> be omitted from the output
>>>>> +     * @param keepSpace
>>>>> +     *            If<code>true</code>  spaces are preserved, else 
>>>>> striped
>>>>> +     * @param indent
>>>>> +     *            If<code>true</code>, the output will be indented
>>>>> +     * @param indentAmount
>>>>> +     *            If<code>indent</code>  is<code>true</code>, the 
>>>>> number of spaces to indent. Default is 4.
>>>>>      * @see<a 
>>>>> href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP 
>>>>> TrAX</a>
>>>>>      * @throws TransformerException
>>>>>      */
>>>>> -    public static void writeXmlDocument(Node node, OutputStream 
>>>>> os, String encoding, boolean omitXmlDeclaration, boolean
>>>>> indent, int indentAmount) throws TransformerException {
>>>>> -        Transformer transformer = 
>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>> indentAmount);
>>>>> +    public static void writeXmlDocument(Node node, OutputStream 
>>>>> os, String encoding, boolean omitXmlDeclaration, boolean
>>>>> indent, int indentAmount,
>>>>> +            boolean keepSpace) throws TransformerException {
>>>>> +        Transformer transformer = 
>>>>> createOutputTransformer(encoding, omitXmlDeclaration, indent, 
>>>>> indentAmount, keepSpace);
>>>>>         transformDomDocument(transformer, node, os);
>>>>>     }
>>>>>
>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>             return;
>>>>>         }
>>>>>         // OutputFormat defaults are: indent on, indent = 4, 
>>>>> include XML declaration,
>>>>> -        // charset = UTF-8, line width = 72
>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>         try {
>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, 
>>>>> false);
>>>>>         } catch (TransformerException e) {
>>>>>             // Wrapping this exception for backwards compatibility
>>>>>             throw new IOException(e.getMessage());
>>>>>
>>>>> Modified: 
>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>>
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>> (original)
>>>>> +++ 
>>>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml 
>>>>> Tue May 15 19:11:13 2012
>>>>> @@ -8,6 +8,7 @@
>>>>>     to you under the Apache License, Version 2.0 (the
>>>>>     "License"); you may not use this file except in compliance
>>>>>     with the License.  You may obtain a copy of the License at
>>>>> +
>>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>>
>>>>>     Unless required by applicable law or agreed to in writing,
>>>>> @@ -17,13 +18,13 @@
>>>>>     specific language governing permissions and limitations
>>>>>     under the License.
>>>>> -->
>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd"> 
>>>>>
>>>>> <property key="AP">
>>>>> <value xml:lang="de">Kreditoren</value>
>>>>> <value xml:lang="en">AP</value>
>>>>> <value xml:lang="es">Compras</value>
>>>>> <value xml:lang="fr">Cpt. fourn.</value>
>>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>> <value xml:lang="it">AP</value>
>>>>> <value xml:lang="nl">Schulden</value>
>>>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>>>> @@ -127,6 +128,7 @@
>>>>> <property key="CommonAbort">
>>>>> <value xml:lang="en">Abort</value>
>>>>> <value xml:lang="es">Cancelar</value>
>>>>> +<value xml:lang="fr">Abandonner</value>
>>>>> <value xml:lang="vi">Hủy</value>
>>>>> </property>
>>>>> <property key="CommonAccepted">
>>>>> @@ -413,6 +415,7 @@
>>>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>> <value xml:lang="en">Address not found.</value>
>>>>> <value xml:lang="es">Dirección no encontrada.</value>
>>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>> </property>
>>>>> <property key="CommonAddresses">
>>>>> @@ -2770,7 +2773,8 @@
>>>>> <value xml:lang="zh_TW">電子郵件</value>
>>>>> </property>
>>>>> <property key="CommonEmptyHeader">
>>>>> -<value xml:lang="en" xml:space="preserve"> </value><!-- do not  
>>>>> remove this! -->
>>>>> +<!-- do not  remove this! -->
>>>>> +<value xml:lang="en" xml:space="preserve"> </value>
>>>>> </property>
>>>>> <property key="CommonEnable">
>>>>> <value xml:lang="en">Enable</value>
>>>>> @@ -11081,6 +11085,31 @@
>>>>> <value xml:lang="zh">有效日期</value>
>>>>> <value xml:lang="zh_TW">有效日</value>
>>>>> </property>
>>>>> +<property key="FormFieldTitle_expireButton">
>>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>>> +<value xml:lang="cs">Vypršet</value>
>>>>> +<value xml:lang="de">Ablaufen</value>
>>>>> +<value xml:lang="en">Expire</value>
>>>>> +<value xml:lang="es">Expiración</value>
>>>>> +<value xml:lang="fr">Invalider</value>
>>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>>> +<value xml:lang="it">Scade</value>
>>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>>> +<value xml:lang="pt">Expirar</value>
>>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>>> +<value xml:lang="ro">Expira</value>
>>>>> +<value xml:lang="ru">Прекратить</value>
>>>>> +<value xml:lang="th">หมดเขต</value>
>>>>> +<value xml:lang="vi">Hết hạn</value>
>>>>> +<value xml:lang="zh">过期</value>
>>>>> +<value xml:lang="zh-CN">过期</value>
>>>>> +<value xml:lang="zh-TW">過期</value>
>>>>> +</property>
>>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>>> +</property>
>>>>> <property key="FormFieldTitle_externalDeviceId">
>>>>> <value xml:lang="en">External Device Id</value>
>>>>> <value xml:lang="es">Código dispositivo externo</value>
>>>>> @@ -11091,11 +11120,6 @@
>>>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>>>> </property>
>>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>>> -</property>
>>>>> <property key="FormFieldTitle_fromDate">
>>>>> <value xml:lang="ar">تاريخ البدء</value>
>>>>> <value xml:lang="de">Von Datum</value>
>>>>>
>>>>> Modified: 
>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>> (original)
>>>>> +++ 
>>>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java 
>>>>> Tue May 15
>>>>> 19:11:13 2012
>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> import org.ofbiz.base.util.UtilXml;
>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>> -
>>>>> import org.ofbiz.service.DispatchContext;
>>>>> import org.ofbiz.service.ServiceUtil;
>>>>> -
>>>>> import org.w3c.dom.Comment;
>>>>> import org.w3c.dom.Document;
>>>>> import org.w3c.dom.Element;
>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>                         if (apacheLicenseText != null) {
>>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>>                         }
>>>>> -                        UtilXml.writeXmlDocument(resourceElem, 
>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>>> +                        UtilXml.writeXmlDocument(resourceElem, 
>>>>> fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>>                     } finally {
>>>>>                         fos.close();
>>>>>                         // clear cache to see immediately the new 
>>>>> labels and
>>>>>
>>>>>

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
I don't agree, it does not hide a problem, it solves a problem.

The (keepSpace=true) version  is only used in SaveLabelsToXmlFile.saveLabelsToXmlFile(), nothing else is changed functionally.

Would you not agree with this patch?

Index: framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
===================================================================
--- framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (revision 1338984)
+++ framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (working copy)
@@ -113,6 +113,7 @@
                 resourceElem.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
                 resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd");
                 for (String labelKey : labelsList) {
+                    boolean keepSpaces = false;
                     LabelInfo labelInfo = labels.get(labelKey);
                     if (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) {
                         continue;
@@ -136,6 +137,7 @@
                             valueElem.setAttribute("xml:lang", localeFound);
                             if (valueString.trim().isEmpty()) {
                                 valueElem.setAttribute("xml:space", "preserve");
+                                keepSpaces = true;
                             }
                             if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
                                 Comment labelComment =
resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment()));
@@ -149,7 +151,7 @@
                         if (apacheLicenseText != null) {
                             fos.write(apacheLicenseText.getBytes());
                         }
-                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
+                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, keepSpaces);
                     } finally {
                         fos.close();
                         // clear cache to see immediately the new labels and

Jacques

From: "Adrian Crum" <ad...@sandglass-software.com>
> The bad thing about this change is that it is not necessary. This change hides a problem - it does not solve it. I mentioned that
> in the Jira issue.
>
> The method is supposed to pretty-print an XML document, and if you turn off space removal, the indentation will be wrong. In other
> words, it will not be pretty.
>
> -1 on this change in any version.
>
> -Adrian
>
> On 5/16/2012 2:25 AM, Scott Gray wrote:
>> I see in your subsequent commits that you encountered the problems caused by this type of change.
>>
>> They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can do
>> to make the need for this any clearer to you.  Please remember your responsibilities as a committer.
>>
>> Regards
>> Scott
>>
>> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>>
>>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches.
>>> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old
>>> method.  Obviously deprecation shouldn't be back-ported.
>>>
>>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>>>
>>> Regards
>>> Scott
>>>
>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>
>>>> Author: jleroux
>>>> Date: Tue May 15 19:11:13 2012
>>>> New Revision: 1338836
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>> Log:
>>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>>> ------------------------------------------------------------------------
>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>>
>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into
>>>> UtilXml.createOutputTransformer()
>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>>> * Adds the xml:space attribute into the valueType complexType
>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>
>>>> I got an issue when 1st trying to commit:
>>>> Commit failed (details follow):
>>>> While preparing
>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>>> Inconsistent line ending style
>>>>
>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>> ------------------------------------------------------------------------
>>>> 
>>>>
>>>> Modified:
>>>>    ofbiz/branches/release12.04/   (props changed)
>>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>
>>>> Propchange: ofbiz/branches/release12.04/
>>>> ------------------------------------------------------------------------------
>>>> Merged /ofbiz/trunk:r1338831
>>>>
>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>>> @@ -29,4 +29,5 @@ under the License.
>>>>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>>> +<system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>>> </catalog>
>>>>
>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>>> @@ -42,6 +42,7 @@ under the License.
>>>>         <xs:simpleContent>
>>>>             <xs:extension base="xs:string">
>>>>                 <xs:attribute ref="xml:lang"/>
>>>> +<xs:attribute ref="xml:space"/>
>>>>             </xs:extension>
>>>>         </xs:simpleContent>
>>>>     </xs:complexType>
>>>>
>>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>
>>>>     // ----- TrAX Methods ----------------- //
>>>>
>>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>>> -     * XML document. This method is provided as an alternative to the
>>>> -     * deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative
>>>> to the deprecated
>>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>>> +     *
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>> +     * @param indent
>>>> +     *            If<code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>> +     * @param keepSpace
>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>>      * @return A<code>Transformer</code>  instance
>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>      * @throws TransformerConfigurationException
>>>>      */
>>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount) throws TransformerConfigurationException {
>>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int
>>>> indentAmount, boolean keepSpace)
>>>> +            throws TransformerConfigurationException {
>>>>         StringBuilder sb = new StringBuilder();
>>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>>             sb.append("\"");
>>>>         }
>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        if (keepSpace) {
>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>> +        } else {
>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        }
>>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>         transformer.transform(source, result);
>>>>     }
>>>>
>>>> -    /** Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>
>>>> -     * using JAXP TrAX.
>>>> -     * @param node The<code>Node</code>  to serialize
>>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If<code>true</code>, the output will be indented
>>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>  using JAXP TrAX.
>>>> +     *
>>>> +     * @param node
>>>> +     *            The<code>Node</code>  to serialize
>>>> +     * @param os
>>>> +     *            The<code>OutputStream</code>  to serialize to
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>>> +     * @param keepSpace
>>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>> +     * @param indent
>>>> +     *            If<code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>      * @throws TransformerException
>>>>      */
>>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>> indent, int indentAmount) throws TransformerException {
>>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean
>>>> indent, int indentAmount,
>>>> +            boolean keepSpace) throws TransformerException {
>>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>         transformDomDocument(transformer, node, os);
>>>>     }
>>>>
>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>             return;
>>>>         }
>>>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>>> -        // charset = UTF-8, line width = 72
>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>         try {
>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>>         } catch (TransformerException e) {
>>>>             // Wrapping this exception for backwards compatibility
>>>>             throw new IOException(e.getMessage());
>>>>
>>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>>> @@ -8,6 +8,7 @@
>>>>     to you under the Apache License, Version 2.0 (the
>>>>     "License"); you may not use this file except in compliance
>>>>     with the License.  You may obtain a copy of the License at
>>>> +
>>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>>
>>>>     Unless required by applicable law or agreed to in writing,
>>>> @@ -17,13 +18,13 @@
>>>>     specific language governing permissions and limitations
>>>>     under the License.
>>>> -->
>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>     <property key="AP">
>>>>         <value xml:lang="de">Kreditoren</value>
>>>>         <value xml:lang="en">AP</value>
>>>>         <value xml:lang="es">Compras</value>
>>>>         <value xml:lang="fr">Cpt. fourn.</value>
>>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>>         <value xml:lang="it">AP</value>
>>>>         <value xml:lang="nl">Schulden</value>
>>>>         <value xml:lang="pt_BR">Contas a pagar</value>
>>>> @@ -127,6 +128,7 @@
>>>>     <property key="CommonAbort">
>>>>         <value xml:lang="en">Abort</value>
>>>>         <value xml:lang="es">Cancelar</value>
>>>> +<value xml:lang="fr">Abandonner</value>
>>>>         <value xml:lang="vi">Hủy</value>
>>>>     </property>
>>>>     <property key="CommonAccepted">
>>>> @@ -413,6 +415,7 @@
>>>>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>         <value xml:lang="en">Address not found.</value>
>>>>         <value xml:lang="es">Dirección no encontrada.</value>
>>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>>         <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>>     </property>
>>>>     <property key="CommonAddresses">
>>>> @@ -2770,7 +2773,8 @@
>>>>         <value xml:lang="zh_TW">電子郵件</value>
>>>>     </property>
>>>>     <property key="CommonEmptyHeader">
>>>> -<value xml:lang="en" xml:space="preserve">  </value><!-- do not  remove this! -->
>>>> +<!-- do not  remove this! -->
>>>> +<value xml:lang="en" xml:space="preserve">  </value>
>>>>     </property>
>>>>     <property key="CommonEnable">
>>>>         <value xml:lang="en">Enable</value>
>>>> @@ -11081,6 +11085,31 @@
>>>>         <value xml:lang="zh">有效日期</value>
>>>>         <value xml:lang="zh_TW">有效日</value>
>>>>     </property>
>>>> +<property key="FormFieldTitle_expireButton">
>>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>>> +<value xml:lang="cs">Vypršet</value>
>>>> +<value xml:lang="de">Ablaufen</value>
>>>> +<value xml:lang="en">Expire</value>
>>>> +<value xml:lang="es">Expiración</value>
>>>> +<value xml:lang="fr">Invalider</value>
>>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>>> +<value xml:lang="it">Scade</value>
>>>> +<value xml:lang="nl">Maak verlopen</value>
>>>> +<value xml:lang="pt">Expirar</value>
>>>> +<value xml:lang="pt-PT">Terminar</value>
>>>> +<value xml:lang="ro">Expira</value>
>>>> +<value xml:lang="ru">Прекратить</value>
>>>> +<value xml:lang="th">หมดเขต</value>
>>>> +<value xml:lang="vi">Hết hạn</value>
>>>> +<value xml:lang="zh">过期</value>
>>>> +<value xml:lang="zh-CN">过期</value>
>>>> +<value xml:lang="zh-TW">過期</value>
>>>> +</property>
>>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>>> +<value xml:lang="fr">Obj. de l'action</value>
>>>> +</property>
>>>>     <property key="FormFieldTitle_externalDeviceId">
>>>>         <value xml:lang="en">External Device Id</value>
>>>>         <value xml:lang="es">Código dispositivo externo</value>
>>>> @@ -11091,11 +11120,6 @@
>>>>         <value xml:lang="es">Código tipo dispositivo externo</value>
>>>>         <value xml:lang="fr">Type de Mat. Externe</value>
>>>>     </property>
>>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>>> -<value xml:lang="fr">Obj. de l'action</value>
>>>> -</property>
>>>>     <property key="FormFieldTitle_fromDate">
>>>>         <value xml:lang="ar">تاريخ البدء</value>
>>>>         <value xml:lang="de">Von Datum</value>
>>>>
>>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15
>>>> 19:11:13 2012
>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.base.util.UtilXml;
>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>> -
>>>> import org.ofbiz.service.DispatchContext;
>>>> import org.ofbiz.service.ServiceUtil;
>>>> -
>>>> import org.w3c.dom.Comment;
>>>> import org.w3c.dom.Document;
>>>> import org.w3c.dom.Element;
>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>                         if (apacheLicenseText != null) {
>>>>                             fos.write(apacheLicenseText.getBytes());
>>>>                         }
>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>                     } finally {
>>>>                         fos.close();
>>>>                         // clear cache to see immediately the new labels and
>>>>
>>>>

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adrian Crum <ad...@sandglass-software.com>.
The bad thing about this change is that it is not necessary. This change 
hides a problem - it does not solve it. I mentioned that in the Jira issue.

The method is supposed to pretty-print an XML document, and if you turn 
off space removal, the indentation will be wrong. In other words, it 
will not be pretty.

-1 on this change in any version.

-Adrian

On 5/16/2012 2:25 AM, Scott Gray wrote:
> I see in your subsequent commits that you encountered the problems caused by this type of change.
>
> They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can do to make the need for this any clearer to you.  Please remember your responsibilities as a committer.
>
> Regards
> Scott
>
> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
>
>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches.  Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method.  Obviously deprecation shouldn't be back-ported.
>>
>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>>
>> Regards
>> Scott
>>
>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>
>>> Author: jleroux
>>> Date: Tue May 15 19:11:13 2012
>>> New Revision: 1338836
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>> Log:
>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>> ------------------------------------------------------------------------
>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>
>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>> * Adds the xml:space attribute into the valueType complexType
>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>
>>> I got an issue when 1st trying to commit:
>>> Commit failed (details follow):
>>> While preparing
>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>> Inconsistent line ending style
>>>
>>> So I forced the EOLs to my locale platform value (Win XP)
>>> ------------------------------------------------------------------------
>>> 
>>>
>>> Modified:
>>>    ofbiz/branches/release12.04/   (props changed)
>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>
>>> Propchange: ofbiz/branches/release12.04/
>>> ------------------------------------------------------------------------------
>>> Merged /ofbiz/trunk:r1338831
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>> @@ -29,4 +29,5 @@ under the License.
>>>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>> +<system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>> </catalog>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>> @@ -42,6 +42,7 @@ under the License.
>>>         <xs:simpleContent>
>>>             <xs:extension base="xs:string">
>>>                 <xs:attribute ref="xml:lang"/>
>>> +<xs:attribute ref="xml:space"/>
>>>             </xs:extension>
>>>         </xs:simpleContent>
>>>     </xs:complexType>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>
>>>     // ----- TrAX Methods ----------------- //
>>>
>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>> -     * XML document. This method is provided as an alternative to the
>>> -     * deprecated<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>> -     * will be omitted from the output
>>> -     * @param indent If<code>true</code>, the output will be indented
>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>> -     * the number of spaces to indent. Default is 4.
>>> +    /**
>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>>> +     *<code>org.apache.xml.serialize.OutputFormat</code>  class.
>>> +     *
>>> +     * @param encoding
>>> +     *            Optional encoding, defaults to UTF-8
>>> +     * @param omitXmlDeclaration
>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>> +     * @param indent
>>> +     *            If<code>true</code>, the output will be indented
>>> +     * @param indentAmount
>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>> +     * @param keepSpace
>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>>      * @return A<code>Transformer</code>  instance
>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>      * @throws TransformerConfigurationException
>>>      */
>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>>> +            throws TransformerConfigurationException {
>>>         StringBuilder sb = new StringBuilder();
>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>             sb.append(indentAmount<= 0 ? 4 : indentAmount);
>>>             sb.append("\"");
>>>         }
>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> +        if (keepSpace) {
>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>> +        } else {
>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> +        }
>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>         transformer.transform(source, result);
>>>     }
>>>
>>> -    /** Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>
>>> -     * using JAXP TrAX.
>>> -     * @param node The<code>Node</code>  to serialize
>>> -     * @param os The<code>OutputStream</code>  to serialize to
>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>> -     * @param omitXmlDeclaration If<code>true</code>  the xml declaration
>>> -     * will be omitted from the output
>>> -     * @param indent If<code>true</code>, the output will be indented
>>> -     * @param indentAmount If<code>indent</code>  is<code>true</code>,
>>> -     * the number of spaces to indent. Default is 4.
>>> +    /**
>>> +     * Serializes a DOM<code>Node</code>  to an<code>OutputStream</code>  using JAXP TrAX.
>>> +     *
>>> +     * @param node
>>> +     *            The<code>Node</code>  to serialize
>>> +     * @param os
>>> +     *            The<code>OutputStream</code>  to serialize to
>>> +     * @param encoding
>>> +     *            Optional encoding, defaults to UTF-8
>>> +     * @param omitXmlDeclaration
>>> +     *            If<code>true</code>  the xml declaration will be omitted from the output
>>> +     * @param keepSpace
>>> +     *            If<code>true</code>  spaces are preserved, else striped
>>> +     * @param indent
>>> +     *            If<code>true</code>, the output will be indented
>>> +     * @param indentAmount
>>> +     *            If<code>indent</code>  is<code>true</code>, the number of spaces to indent. Default is 4.
>>>      * @see<a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>      * @throws TransformerException
>>>      */
>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>>> +            boolean keepSpace) throws TransformerException {
>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>         transformDomDocument(transformer, node, os);
>>>     }
>>>
>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>             return;
>>>         }
>>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>> -        // charset = UTF-8, line width = 72
>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>         try {
>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>         } catch (TransformerException e) {
>>>             // Wrapping this exception for backwards compatibility
>>>             throw new IOException(e.getMessage());
>>>
>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>> @@ -8,6 +8,7 @@
>>>     to you under the Apache License, Version 2.0 (the
>>>     "License"); you may not use this file except in compliance
>>>     with the License.  You may obtain a copy of the License at
>>> +
>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>
>>>     Unless required by applicable law or agreed to in writing,
>>> @@ -17,13 +18,13 @@
>>>     specific language governing permissions and limitations
>>>     under the License.
>>> -->
>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>     <property key="AP">
>>>         <value xml:lang="de">Kreditoren</value>
>>>         <value xml:lang="en">AP</value>
>>>         <value xml:lang="es">Compras</value>
>>>         <value xml:lang="fr">Cpt. fourn.</value>
>>> -<value xml:lang="hi_IN">लेखा देय</value>
>>> +<value xml:lang="hi-IN">लेखा देय</value>
>>>         <value xml:lang="it">AP</value>
>>>         <value xml:lang="nl">Schulden</value>
>>>         <value xml:lang="pt_BR">Contas a pagar</value>
>>> @@ -127,6 +128,7 @@
>>>     <property key="CommonAbort">
>>>         <value xml:lang="en">Abort</value>
>>>         <value xml:lang="es">Cancelar</value>
>>> +<value xml:lang="fr">Abandonner</value>
>>>         <value xml:lang="vi">Hủy</value>
>>>     </property>
>>>     <property key="CommonAccepted">
>>> @@ -413,6 +415,7 @@
>>>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>         <value xml:lang="en">Address not found.</value>
>>>         <value xml:lang="es">Dirección no encontrada.</value>
>>> +<value xml:lang="fr">Adresse inconnue</value>
>>>         <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>>     </property>
>>>     <property key="CommonAddresses">
>>> @@ -2770,7 +2773,8 @@
>>>         <value xml:lang="zh_TW">電子郵件</value>
>>>     </property>
>>>     <property key="CommonEmptyHeader">
>>> -<value xml:lang="en" xml:space="preserve">  </value><!-- do not  remove this! -->
>>> +<!-- do not  remove this! -->
>>> +<value xml:lang="en" xml:space="preserve">  </value>
>>>     </property>
>>>     <property key="CommonEnable">
>>>         <value xml:lang="en">Enable</value>
>>> @@ -11081,6 +11085,31 @@
>>>         <value xml:lang="zh">有效日期</value>
>>>         <value xml:lang="zh_TW">有效日</value>
>>>     </property>
>>> +<property key="FormFieldTitle_expireButton">
>>> +<value xml:lang="ar">نهاية الصلاحية</value>
>>> +<value xml:lang="cs">Vypršet</value>
>>> +<value xml:lang="de">Ablaufen</value>
>>> +<value xml:lang="en">Expire</value>
>>> +<value xml:lang="es">Expiración</value>
>>> +<value xml:lang="fr">Invalider</value>
>>> +<value xml:lang="hi-IN">निश्वासन</value>
>>> +<value xml:lang="it">Scade</value>
>>> +<value xml:lang="nl">Maak verlopen</value>
>>> +<value xml:lang="pt">Expirar</value>
>>> +<value xml:lang="pt-PT">Terminar</value>
>>> +<value xml:lang="ro">Expira</value>
>>> +<value xml:lang="ru">Прекратить</value>
>>> +<value xml:lang="th">หมดเขต</value>
>>> +<value xml:lang="vi">Hết hạn</value>
>>> +<value xml:lang="zh">过期</value>
>>> +<value xml:lang="zh-CN">过期</value>
>>> +<value xml:lang="zh-TW">過期</value>
>>> +</property>
>>> +<property key="FormFieldTitle_extDevicePurposeActionId">
>>> +<value xml:lang="en">External Device Purpose Action Id</value>
>>> +<value xml:lang="es">Código acción dispositivo externo</value>
>>> +<value xml:lang="fr">Obj. de l'action</value>
>>> +</property>
>>>     <property key="FormFieldTitle_externalDeviceId">
>>>         <value xml:lang="en">External Device Id</value>
>>>         <value xml:lang="es">Código dispositivo externo</value>
>>> @@ -11091,11 +11120,6 @@
>>>         <value xml:lang="es">Código tipo dispositivo externo</value>
>>>         <value xml:lang="fr">Type de Mat. Externe</value>
>>>     </property>
>>> -<property key="FormFieldTitle_extDevicePurposeActionId">
>>> -<value xml:lang="en">External Device Purpose Action Id</value>
>>> -<value xml:lang="es">Código acción dispositivo externo</value>
>>> -<value xml:lang="fr">Obj. de l'action</value>
>>> -</property>
>>>     <property key="FormFieldTitle_fromDate">
>>>         <value xml:lang="ar">تاريخ البدء</value>
>>>         <value xml:lang="de">Von Datum</value>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.base.util.UtilXml;
>>> import org.ofbiz.base.util.cache.UtilCache;
>>> -
>>> import org.ofbiz.service.DispatchContext;
>>> import org.ofbiz.service.ServiceUtil;
>>> -
>>> import org.w3c.dom.Comment;
>>> import org.w3c.dom.Document;
>>> import org.w3c.dom.Element;
>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>                         if (apacheLicenseText != null) {
>>>                             fos.write(apacheLicenseText.getBytes());
>>>                         }
>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>                     } finally {
>>>                         fos.close();
>>>                         // clear cache to see immediately the new labels and
>>>
>>>

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Not only that but for a lot of back-ports I don't think that script (while great) goes far enough.  Compiling, loading data and running the tests doesn't necessarily mean that the merge is good given that our tests aren't anywhere near close to full coverage.

IMO it's critical that the committer ensures stability in the branches by treating the back-port as a stand-alone commit with a proper code review and if needed, manual testing.  Back-porting is not a quick and simple task and shouldn't be treated as an afterthought.

Regards
Scott

On 16/05/2012, at 1:28 PM, Adam Heath wrote:

> This is why I spent time to make the complex shell script(and someone else did the .bat). Why not use those?
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
> 
> Scott Gray <sc...@hotwaxmedia.com> wrote:
> 
> I see in your subsequent commits that you encountered the problems caused by this type of change. 
> 
> They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can do to make the need for this any clearer to you. Please remember your responsibilities as a committer.
> 
> Regards
> Scott
> 
> On 16/05/2012, at 1:17 PM, Scott Gray wrote:
> 
>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method. Obviously deprecation shouldn't be back-ported.
>> 
>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>> 
>> Regards
>> Scott
>> 
>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>> 
>>> Author: jleroux
>>> Date: Tue May 15 19:11:13 2012
>>> New Revision: 1338836
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>> Log:
>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>> _____________________________________________
> 
>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>> 
>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
>>> * Adds the xml:space attribute into the valueType complexType
>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>> 
>>> I got an issue when 1st trying to commit: 
>>> Commit failed (details follow):
>>> While preparing
>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>> Inconsistent line ending style
>>> 
>>> So I forced the EOLs to my locale platform value (Win XP)
>>> _____________________________________________
> 
>>> 
>>> 
>>> Modified:
>>> ofbiz/branches/release12.04/ (props changed)
>>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>> 
>>> Propchange: ofbiz/branches/release12.04/
>>> _____________________________________________
> 
>>> Merged /ofbiz/trunk:r1338831
>>> 
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> _____________________________________________
> 
>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>> @@ -29,4 +29,5 @@ under the License.
>>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>> + <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>> </catalog>
>>> 
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> _____________________________________________
> 
>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>> @@ -42,6 +42,7 @@ under the License.
>>> <xs:simpleContent>
>>> <xs:extension base="xs:string">
>>> <xs:attribute ref="xml:lang"/>
>>> + <xs:attribute ref="xml:space"/>
>>> </xs:extension>
>>> </xs:simpleContent>
>>> </xs:complexType>
>>> 
>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> _____________________________________________
> 
>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>> 
>>> // ----- TrAX Methods ----------------- //
>>> 
>>> - /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>> - * XML document. This method is provided as an alternative to the
>>> - * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>>> - * @param encoding Optional encoding, defaults to UTF-8
>>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>> - * will be omitted from the output
>>> - * @param indent If <code>true</code>, the output will be indented
>>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>>> - * the number of spaces to indent. Default is 4.
>>> + /**
>>> + * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>>> + * <code>org.apache.xml.serialize.OutputFormat</code> class.
>>> + * 
>>> + * @param encoding
>>> + * Optional encoding, defaults to UTF-8
>>> + * @param omitXmlDeclaration
>>> + * If <code>true</code> the xml declaration will be omitted from the output
>>> + * @param indent
>>> + * If <code>true</code>, the output will be indented
>>> + * @param indentAmount
>>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>> + * @param keepSpace
>>> + * If <code>true</code> spaces are preserved, else striped
>>> * @return A <code>Transformer</code> instance
>>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>> * @throws TransformerConfigurationException
>>> */
>>> - public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>>> + public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>>> + throws TransformerConfigurationException {
>>> StringBuilder sb = new StringBuilder();
>>> sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>> sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>> sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>> sb.append("\"");
>>> }
>>> - sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> + if (keepSpace) {
>>> + sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>> + } else {
>>> + sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> + }
>>> sb.append("<xsl:template match=\"@*|node()\">\n");
>>> sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>> sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>> transformer.transform(source, result);
>>> }
>>> 
>>> - /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>>> - * using JAXP TrAX.
>>> - * @param node The <code>Node</code> to serialize
>>> - * @param os The <code>OutputStream</code> to serialize to
>>> - * @param encoding Optional encoding, defaults to UTF-8
>>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>> - * will be omitted from the output
>>> - * @param indent If <code>true</code>, the output will be indented
>>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>>> - * the number of spaces to indent. Default is 4.
>>> + /**
>>> + * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>>> + * 
>>> + * @param node
>>> + * The <code>Node</code> to serialize
>>> + * @param os
>>> + * The <code>OutputStream</code> to serialize to
>>> + * @param encoding
>>> + * Optional encoding, defaults to UTF-8
>>> + * @param omitXmlDeclaration
>>> + * If <code>true</code> the xml declaration will be omitted from the output
>>> + * @param keepSpace
>>> + * If <code>true</code> spaces are preserved, else striped
>>> + * @param indent
>>> + * If <code>true</code>, the output will be indented
>>> + * @param indentAmount
>>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>> * @throws TransformerException
>>> */
>>> - public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>>> - Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>> + public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>>> + boolean keepSpace) throws TransformerException {
>>> + Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>> transformDomDocument(transformer, node, os);
>>> }
>>> 
>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>> return;
>>> }
>>> // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>> - // charset = UTF-8, line width = 72
>>> + // charset = UTF-8, line width = 72, strip spaces
>>> try {
>>> - writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>> + writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>> } catch (TransformerException e) {
>>> // Wrapping this exception for backwards compatibility
>>> throw new IOException(e.getMessage());
>>> 
>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> _____________________________________________
> 
>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>> @@ -8,6 +8,7 @@
>>> to you under the Apache License, Version 2.0 (the
>>> "License"); you may not use this file except in compliance
>>> with the License. You may obtain a copy of the License at
>>> +
>>> http://www.apache.org/licenses/LICENSE-2.0
>>> 
>>> Unless required by applicable law or agreed to in writing,
>>> @@ -17,13 +18,13 @@
>>> specific language governing permissions and limitations
>>> under the License.
>>> -->
>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>> <property key="AP">
>>> <value xml:lang="de">Kreditoren</value>
>>> <value xml:lang="en">AP</value>
>>> <value xml:lang="es">Compras</value>
>>> <value xml:lang="fr">Cpt. fourn.</value>
>>> - <value xml:lang="hi_IN">लेखा देय</value>
>>> + <value xml:lang="hi-IN">लेखा देय</value>
>>> <value xml:lang="it">AP</value>
>>> <value xml:lang="nl">Schulden</value>
>>> <value xml:lang="pt_BR">Contas a pagar</value>
>>> @@ -127,6 +128,7 @@
>>> <property key="CommonAbort">
>>> <value xml:lang="en">Abort</value>
>>> <value xml:lang="es">Cancelar</value>
>>> + <value xml:lang="fr">Abandonner</value>
>>> <value xml:lang="vi">Hủy</value>
>>> </property>
>>> <property key="CommonAccepted">
>>> @@ -413,6 +415,7 @@
>>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>> <value xml:lang="en">Address not found.</value>
>>> <value xml:lang="es">Dirección no encontrada.</value>
>>> + <value xml:lang="fr">Adresse inconnue</value>
>>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>> </property>
>>> <property key="CommonAddresses">
>>> @@ -2770,7 +2773,8 @@
>>> <value xml:lang="zh_TW">電子郵件</value>
>>> </property>
>>> <property key="CommonEmptyHeader">
>>> - <value xml:lang="en" xml:space="preserve"> </value><!-- do not remove this! -->
>>> + <!-- do not remove this! -->
>>> + <value xml:lang="en" xml:space="preserve"> </value>
>>> </property>
>>> <property key="CommonEnable">
>>> <value xml:lang="en">Enable</value>
>>> @@ -11081,6 +11085,31 @@
>>> <value xml:lang="zh">有效日期</value>
>>> <value xml:lang="zh_TW">有效日</value>
>>> </property>
>>> + <property key="FormFieldTitle_expireButton">
>>> + <value xml:lang="ar">نهاية الصلاحية</value>
>>> + <value xml:lang="cs">Vypršet</value>
>>> + <value xml:lang="de">Ablaufen</value>
>>> + <value xml:lang="en">Expire</value>
>>> + <value xml:lang="es">Expiración</value>
>>> + <value xml:lang="fr">Invalider</value>
>>> + <value xml:lang="hi-IN">निश्वासन</value>
>>> + <value xml:lang="it">Scade</value>
>>> + <value xml:lang="nl">Maak verlopen</value>
>>> + <value xml:lang="pt">Expirar</value>
>>> + <value xml:lang="pt-PT">Terminar</value>
>>> + <value xml:lang="ro">Expira</value>
>>> + <value xml:lang="ru">Прекратить</value>
>>> + <value xml:lang="th">หมดเขต</value>
>>> + <value xml:lang="vi">Hết hạn</value>
>>> + <value xml:lang="zh">过期</value>
>>> + <value xml:lang="zh-CN">过期</value>
>>> + <value xml:lang="zh-TW">過期</value>
>>> + </property>
>>> + <property key="FormFieldTitle_extDevicePurposeActionId">
>>> + <value xml:lang="en">External Device Purpose Action Id</value>
>>> + <value xml:lang="es">Código acción dispositivo externo</value>
>>> + <value xml:lang="fr">Obj. de l'action</value>
>>> + </property>
>>> <property key="FormFieldTitle_externalDeviceId">
>>> <value xml:lang="en">External Device Id</value>
>>> <value xml:lang="es">Código dispositivo externo</value>
>>> @@ -11091,11 +11120,6 @@
>>> <value xml:lang="es">Código tipo dispositivo externo</value>
>>> <value xml:lang="fr">Type de Mat. Externe</value>
>>> </property>
>>> - <property key="FormFieldTitle_extDevicePurposeActionId">
>>> - <value xml:lang="en">External Device Purpose Action Id</value>
>>> - <value xml:lang="es">Código acción dispositivo externo</value>
>>> - <value xml:lang="fr">Obj. de l'action</value>
>>> - </property>
>>> <property key="FormFieldTitle_fromDate">
>>> <value xml:lang="ar">تاريخ البدء</value>
>>> <value xml:lang="de">Von Datum</value>
>>> 
>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> _____________________________________________
> 
>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.base.util.UtilXml;
>>> import org.ofbiz.base.util.cache.UtilCache;
>>> -
>>> import org.ofbiz.service.DispatchContext;
>>> import org.ofbiz.service.ServiceUtil;
>>> -
>>> import org.w3c.dom.Comment;
>>> import org.w3c.dom.Document;
>>> import org.w3c.dom.Element;
>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>> if (apacheLicenseText != null) {
>>> fos.write(apacheLicenseText.getBytes());
>>> }
>>> - UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>> + UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>> } finally {
>>> fos.close();
>>> // clear cache to see immediately the new labels and
>>> 
>>> 
>> 
> 
> 


Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adam Heath <do...@brainfood.com>.
This is why I spent time to make the complex shell script(and someone else did the .bat). Why not use those?
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Scott Gray <sc...@hotwaxmedia.com> wrote:

I see in your subsequent commits that you encountered the problems caused by this type of change. 

They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can do to make the need for this any clearer to you. Please remember your responsibilities as a committer.

Regards
Scott

On 16/05/2012, at 1:17 PM, Scott Gray wrote:

> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method. Obviously deprecation shouldn't be back-ported.
> 
> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
> 
> Regards
> Scott
> 
> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
> 
>> Author: jleroux
>> Date: Tue May 15 19:11:13 2012
>> New Revision: 1338836
>> 
>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>> Log:
>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>_____________________________________________

>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>> 
>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
>> * Adds the xml:space attribute into the valueType complexType
>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>> 
>> I got an issue when 1st trying to commit: 
>> Commit failed (details follow):
>> While preparing
>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>> Inconsistent line ending style
>> 
>> So I forced the EOLs to my locale platform value (Win XP)
>>_____________________________________________

>> 
>> 
>> Modified:
>> ofbiz/branches/release12.04/ (props changed)
>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> 
>> Propchange: ofbiz/branches/release12.04/
>>_____________________________________________

>> Merged /ofbiz/trunk:r1338831
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>> @@ -29,4 +29,5 @@ under the License.
>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>> + <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>> </catalog>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>> @@ -42,6 +42,7 @@ under the License.
>> <xs:simpleContent>
>> <xs:extension base="xs:string">
>> <xs:attribute ref="xml:lang"/>
>> + <xs:attribute ref="xml:space"/>
>> </xs:extension>
>> </xs:simpleContent>
>> </xs:complexType>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>> @@ -158,20 +158,26 @@ public class UtilXml {
>> 
>> // ----- TrAX Methods ----------------- //
>> 
>> - /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>> - * XML document. This method is provided as an alternative to the
>> - * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>> + * <code>org.apache.xml.serialize.OutputFormat</code> class.
>> + * 
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> * @return A <code>Transformer</code> instance
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerConfigurationException
>> */
>> - public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>> + public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>> + throws TransformerConfigurationException {
>> StringBuilder sb = new StringBuilder();
>> sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>> sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>> @@ -189,7 +195,11 @@ public class UtilXml {
>> sb.append(indentAmount <= 0 ? 4 : indentAmount);
>> sb.append("\"");
>> }
>> - sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + if (keepSpace) {
>> + sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>> + } else {
>> + sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + }
>> sb.append("<xsl:template match=\"@*|node()\">\n");
>> sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>> sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>> @@ -212,21 +222,29 @@ public class UtilXml {
>> transformer.transform(source, result);
>> }
>> 
>> - /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>> - * using JAXP TrAX.
>> - * @param node The <code>Node</code> to serialize
>> - * @param os The <code>OutputStream</code> to serialize to
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>> + * 
>> + * @param node
>> + * The <code>Node</code> to serialize
>> + * @param os
>> + * The <code>OutputStream</code> to serialize to
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerException
>> */
>> - public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>> - Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>> + public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>> + boolean keepSpace) throws TransformerException {
>> + Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>> transformDomDocument(transformer, node, os);
>> }
>> 
>> @@ -325,9 +343,9 @@ public class UtilXml {
>> return;
>> }
>> // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>> - // charset = UTF-8, line width = 72
>> + // charset = UTF-8, line width = 72, strip spaces
>> try {
>> - writeXmlDocument(node, os, "UTF-8", false, true, 4);
>> + writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>> } catch (TransformerException e) {
>> // Wrapping this exception for backwards compatibility
>> throw new IOException(e.getMessage());
>> 
>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>> @@ -8,6 +8,7 @@
>> to you under the Apache License, Version 2.0 (the
>> "License"); you may not use this file except in compliance
>> with the License. You may obtain a copy of the License at
>> +
>> http://www.apache.org/licenses/LICENSE-2.0
>> 
>> Unless required by applicable law or agreed to in writing,
>> @@ -17,13 +18,13 @@
>> specific language governing permissions and limitations
>> under the License.
>> -->
>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>> <property key="AP">
>> <value xml:lang="de">Kreditoren</value>
>> <value xml:lang="en">AP</value>
>> <value xml:lang="es">Compras</value>
>> <value xml:lang="fr">Cpt. fourn.</value>
>> - <value xml:lang="hi_IN">लेखा देय</value>
>> + <value xml:lang="hi-IN">लेखा देय</value>
>> <value xml:lang="it">AP</value>
>> <value xml:lang="nl">Schulden</value>
>> <value xml:lang="pt_BR">Contas a pagar</value>
>> @@ -127,6 +128,7 @@
>> <property key="CommonAbort">
>> <value xml:lang="en">Abort</value>
>> <value xml:lang="es">Cancelar</value>
>> + <value xml:lang="fr">Abandonner</value>
>> <value xml:lang="vi">Hủy</value>
>> </property>
>> <property key="CommonAccepted">
>> @@ -413,6 +415,7 @@
>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>> <value xml:lang="en">Address not found.</value>
>> <value xml:lang="es">Dirección no encontrada.</value>
>> + <value xml:lang="fr">Adresse inconnue</value>
>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>> </property>
>> <property key="CommonAddresses">
>> @@ -2770,7 +2773,8 @@
>> <value xml:lang="zh_TW">電子郵件</value>
>> </property>
>> <property key="CommonEmptyHeader">
>> - <value xml:lang="en" xml:space="preserve"> </value><!-- do not remove this! -->
>> + <!-- do not remove this! -->
>> + <value xml:lang="en" xml:space="preserve"> </value>
>> </property>
>> <property key="CommonEnable">
>> <value xml:lang="en">Enable</value>
>> @@ -11081,6 +11085,31 @@
>> <value xml:lang="zh">有效日期</value>
>> <value xml:lang="zh_TW">有效日</value>
>> </property>
>> + <property key="FormFieldTitle_expireButton">
>> + <value xml:lang="ar">نهاية الصلاحية</value>
>> + <value xml:lang="cs">Vypršet</value>
>> + <value xml:lang="de">Ablaufen</value>
>> + <value xml:lang="en">Expire</value>
>> + <value xml:lang="es">Expiración</value>
>> + <value xml:lang="fr">Invalider</value>
>> + <value xml:lang="hi-IN">निश्वासन</value>
>> + <value xml:lang="it">Scade</value>
>> + <value xml:lang="nl">Maak verlopen</value>
>> + <value xml:lang="pt">Expirar</value>
>> + <value xml:lang="pt-PT">Terminar</value>
>> + <value xml:lang="ro">Expira</value>
>> + <value xml:lang="ru">Прекратить</value>
>> + <value xml:lang="th">หมดเขต</value>
>> + <value xml:lang="vi">Hết hạn</value>
>> + <value xml:lang="zh">过期</value>
>> + <value xml:lang="zh-CN">过期</value>
>> + <value xml:lang="zh-TW">過期</value>
>> + </property>
>> + <property key="FormFieldTitle_extDevicePurposeActionId">
>> + <value xml:lang="en">External Device Purpose Action Id</value>
>> + <value xml:lang="es">Código acción dispositivo externo</value>
>> + <value xml:lang="fr">Obj. de l'action</value>
>> + </property>
>> <property key="FormFieldTitle_externalDeviceId">
>> <value xml:lang="en">External Device Id</value>
>> <value xml:lang="es">Código dispositivo externo</value>
>> @@ -11091,11 +11120,6 @@
>> <value xml:lang="es">Código tipo dispositivo externo</value>
>> <value xml:lang="fr">Type de Mat. Externe</value>
>> </property>
>> - <property key="FormFieldTitle_extDevicePurposeActionId">
>> - <value xml:lang="en">External Device Purpose Action Id</value>
>> - <value xml:lang="es">Código acción dispositivo externo</value>
>> - <value xml:lang="fr">Obj. de l'action</value>
>> - </property>
>> <property key="FormFieldTitle_fromDate">
>> <value xml:lang="ar">تاريخ البدء</value>
>> <value xml:lang="de">Von Datum</value>
>> 
>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.UtilXml;
>> import org.ofbiz.base.util.cache.UtilCache;
>> -
>> import org.ofbiz.service.DispatchContext;
>> import org.ofbiz.service.ServiceUtil;
>> -
>> import org.w3c.dom.Comment;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>> if (apacheLicenseText != null) {
>> fos.write(apacheLicenseText.getBytes());
>> }
>> - UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>> + UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>> } finally {
>> fos.close();
>> // clear cache to see immediately the new labels and
>> 
>> 
> 



Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I see in your subsequent commits that you encountered the problems caused by this type of change.  

They're also a pretty good indication that once again you didn't compile or test before back-porting, I'm not sure what I can do to make the need for this any clearer to you.  Please remember your responsibilities as a committer.

Regards
Scott

On 16/05/2012, at 1:17 PM, Scott Gray wrote:

> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches.  Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method.  Obviously deprecation shouldn't be back-ported.
> 
> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
> 
> Regards
> Scott
> 
> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
> 
>> Author: jleroux
>> Date: Tue May 15 19:11:13 2012
>> New Revision: 1338836
>> 
>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>> Log:
>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>> ------------------------------------------------------------------------
>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>> 
>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
>> * Adds the xml:space attribute into the valueType complexType
>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>> 
>> I got an issue when 1st trying to commit: 
>> Commit failed (details follow):
>> While preparing
>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>> Inconsistent line ending style
>> 
>> So I forced the EOLs to my locale platform value (Win XP)
>> ------------------------------------------------------------------------
>> 
>> 
>> Modified:
>>   ofbiz/branches/release12.04/   (props changed)
>>   ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>   ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>   ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>   ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>   ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> 
>> Propchange: ofbiz/branches/release12.04/
>> ------------------------------------------------------------------------------
>> Merged /ofbiz/trunk:r1338831
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>> @@ -29,4 +29,5 @@ under the License.
>>    <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>> </catalog>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>> @@ -42,6 +42,7 @@ under the License.
>>        <xs:simpleContent>
>>            <xs:extension base="xs:string">
>>                <xs:attribute ref="xml:lang"/>
>> +                <xs:attribute ref="xml:space"/>
>>            </xs:extension>
>>        </xs:simpleContent>
>>    </xs:complexType>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>> @@ -158,20 +158,26 @@ public class UtilXml {
>> 
>>    // ----- TrAX Methods ----------------- //
>> 
>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>> -     * XML document. This method is provided as an alternative to the
>> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>> -     * @param encoding Optional encoding, defaults to UTF-8
>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> -     * will be omitted from the output
>> -     * @param indent If <code>true</code>, the output will be indented
>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>> -     * the number of spaces to indent. Default is 4.
>> +    /**
>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
>> +     * 
>> +     * @param encoding
>> +     *            Optional encoding, defaults to UTF-8
>> +     * @param omitXmlDeclaration
>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>> +     * @param indent
>> +     *            If <code>true</code>, the output will be indented
>> +     * @param indentAmount
>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> +     * @param keepSpace
>> +     *            If <code>true</code> spaces are preserved, else striped
>>     * @return A <code>Transformer</code> instance
>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>     * @throws TransformerConfigurationException
>>     */
>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>> +            throws TransformerConfigurationException {
>>        StringBuilder sb = new StringBuilder();
>>        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>        sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>> @@ -189,7 +195,11 @@ public class UtilXml {
>>            sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>            sb.append("\"");
>>        }
>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> +        if (keepSpace) {
>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>> +        } else {
>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> +        }
>>        sb.append("<xsl:template match=\"@*|node()\">\n");
>>        sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>        sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>> @@ -212,21 +222,29 @@ public class UtilXml {
>>        transformer.transform(source, result);
>>    }
>> 
>> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>> -     * using JAXP TrAX.
>> -     * @param node The <code>Node</code> to serialize
>> -     * @param os The <code>OutputStream</code> to serialize to
>> -     * @param encoding Optional encoding, defaults to UTF-8
>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> -     * will be omitted from the output
>> -     * @param indent If <code>true</code>, the output will be indented
>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>> -     * the number of spaces to indent. Default is 4.
>> +    /**
>> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>> +     * 
>> +     * @param node
>> +     *            The <code>Node</code> to serialize
>> +     * @param os
>> +     *            The <code>OutputStream</code> to serialize to
>> +     * @param encoding
>> +     *            Optional encoding, defaults to UTF-8
>> +     * @param omitXmlDeclaration
>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>> +     * @param keepSpace
>> +     *            If <code>true</code> spaces are preserved, else striped
>> +     * @param indent
>> +     *            If <code>true</code>, the output will be indented
>> +     * @param indentAmount
>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>     * @throws TransformerException
>>     */
>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>> +            boolean keepSpace) throws TransformerException {
>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>        transformDomDocument(transformer, node, os);
>>    }
>> 
>> @@ -325,9 +343,9 @@ public class UtilXml {
>>            return;
>>        }
>>        // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>> -        // charset = UTF-8, line width = 72
>> +        // charset = UTF-8, line width = 72, strip spaces
>>        try {
>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>        } catch (TransformerException e) {
>>            // Wrapping this exception for backwards compatibility
>>            throw new IOException(e.getMessage());
>> 
>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>> @@ -8,6 +8,7 @@
>>    to you under the Apache License, Version 2.0 (the
>>    "License"); you may not use this file except in compliance
>>    with the License.  You may obtain a copy of the License at
>> +
>>    http://www.apache.org/licenses/LICENSE-2.0
>> 
>>    Unless required by applicable law or agreed to in writing,
>> @@ -17,13 +18,13 @@
>>    specific language governing permissions and limitations
>>    under the License.
>> -->
>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>    <property key="AP">
>>        <value xml:lang="de">Kreditoren</value>
>>        <value xml:lang="en">AP</value>
>>        <value xml:lang="es">Compras</value>
>>        <value xml:lang="fr">Cpt. fourn.</value>
>> -        <value xml:lang="hi_IN">लेखा देय</value>
>> +        <value xml:lang="hi-IN">लेखा देय</value>
>>        <value xml:lang="it">AP</value>
>>        <value xml:lang="nl">Schulden</value>
>>        <value xml:lang="pt_BR">Contas a pagar</value>
>> @@ -127,6 +128,7 @@
>>    <property key="CommonAbort">
>>        <value xml:lang="en">Abort</value>
>>        <value xml:lang="es">Cancelar</value>
>> +        <value xml:lang="fr">Abandonner</value>
>>        <value xml:lang="vi">Hủy</value>
>>    </property>
>>    <property key="CommonAccepted">
>> @@ -413,6 +415,7 @@
>>        <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>        <value xml:lang="en">Address not found.</value>
>>        <value xml:lang="es">Dirección no encontrada.</value>
>> +        <value xml:lang="fr">Adresse inconnue</value>
>>        <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>>    </property>
>>    <property key="CommonAddresses">
>> @@ -2770,7 +2773,8 @@
>>        <value xml:lang="zh_TW">電子郵件</value>
>>    </property>
>>    <property key="CommonEmptyHeader">
>> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>> +        <!-- do not  remove this! -->
>> +        <value xml:lang="en" xml:space="preserve"> </value>
>>    </property>
>>    <property key="CommonEnable">
>>        <value xml:lang="en">Enable</value>
>> @@ -11081,6 +11085,31 @@
>>        <value xml:lang="zh">有效日期</value>
>>        <value xml:lang="zh_TW">有效日</value>
>>    </property>
>> +    <property key="FormFieldTitle_expireButton">
>> +        <value xml:lang="ar">نهاية الصلاحية</value>
>> +        <value xml:lang="cs">Vypršet</value>
>> +        <value xml:lang="de">Ablaufen</value>
>> +        <value xml:lang="en">Expire</value>
>> +        <value xml:lang="es">Expiración</value>
>> +        <value xml:lang="fr">Invalider</value>
>> +        <value xml:lang="hi-IN">निश्वासन</value>
>> +        <value xml:lang="it">Scade</value>
>> +        <value xml:lang="nl">Maak verlopen</value>
>> +        <value xml:lang="pt">Expirar</value>
>> +        <value xml:lang="pt-PT">Terminar</value>
>> +        <value xml:lang="ro">Expira</value>
>> +        <value xml:lang="ru">Прекратить</value>
>> +        <value xml:lang="th">หมดเขต</value>
>> +        <value xml:lang="vi">Hết hạn</value>
>> +        <value xml:lang="zh">过期</value>
>> +        <value xml:lang="zh-CN">过期</value>
>> +        <value xml:lang="zh-TW">過期</value>
>> +    </property>
>> +    <property key="FormFieldTitle_extDevicePurposeActionId">
>> +        <value xml:lang="en">External Device Purpose Action Id</value>
>> +        <value xml:lang="es">Código acción dispositivo externo</value>
>> +        <value xml:lang="fr">Obj. de l'action</value>
>> +    </property>
>>    <property key="FormFieldTitle_externalDeviceId">
>>        <value xml:lang="en">External Device Id</value>
>>        <value xml:lang="es">Código dispositivo externo</value>
>> @@ -11091,11 +11120,6 @@
>>        <value xml:lang="es">Código tipo dispositivo externo</value>
>>        <value xml:lang="fr">Type de Mat. Externe</value>
>>    </property>
>> -    <property key="FormFieldTitle_extDevicePurposeActionId">
>> -        <value xml:lang="en">External Device Purpose Action Id</value>
>> -        <value xml:lang="es">Código acción dispositivo externo</value>
>> -        <value xml:lang="fr">Obj. de l'action</value>
>> -    </property>
>>    <property key="FormFieldTitle_fromDate">
>>        <value xml:lang="ar">تاريخ البدء</value>
>>        <value xml:lang="de">Von Datum</value>
>> 
>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.UtilXml;
>> import org.ofbiz.base.util.cache.UtilCache;
>> -
>> import org.ofbiz.service.DispatchContext;
>> import org.ofbiz.service.ServiceUtil;
>> -
>> import org.w3c.dom.Comment;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>                        if (apacheLicenseText != null) {
>>                            fos.write(apacheLicenseText.getBytes());
>>                        }
>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>                    } finally {
>>                        fos.close();
>>                        // clear cache to see immediately the new labels and
>> 
>> 
> 


Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adam Heath <do...@brainfood.com>.
I use git, I have scripts to test all my commits in a loop, there have been countless times I had a run go over night that takes 4+ hours, then a mass commit. Of course during development I wander, but after rebase -i, commit splitting, reordering, no one ever sees that. I *still* have over 140 commits in my queue on top of trunk, half of those are over 2 years old.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Scott Gray <sc...@hotwaxmedia.com> wrote:

Yeah sure, it's a *general* rule of thumb. Your changes have been discussed and agreed upon, besides I don't think they involved changing public method signatures in a breaking way.

Regards
Scott

On 16/05/2012, at 1:22 PM, Adam Heath wrote:

> Except that I *am* planning on backporting the delegator changes, as it does simplify the api, and makes it easier to backport other changes. But only to 12.04, as that hasn't really been released yet.
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
> 
> Scott Gray <sc...@hotwaxmedia.com> wrote:
> 
> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method. Obviously deprecation shouldn't be back-ported.
> 
> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
> 
> Regards
> Scott
> 
> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
> 
>> Author: jleroux
>> Date: Tue May 15 19:11:13 2012
>> New Revision: 1338836
>> 
>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>> Log:
>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>_____________________________________________

> 
>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>> 
>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
>> * Adds the xml:space attribute into the valueType complexType
>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>> 
>> I got an issue when 1st trying to commit: 
>> Commit failed (details follow):
>> While preparing
>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>> Inconsistent line ending style
>> 
>> So I forced the EOLs to my locale platform value (Win XP)
>>_____________________________________________

> 
>> 
>> 
>> Modified:
>> ofbiz/branches/release12.04/ (props changed)
>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> 
>> Propchange: ofbiz/branches/release12.04/
>>_____________________________________________

> 
>> Merged /ofbiz/trunk:r1338831
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

> 
>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>> @@ -29,4 +29,5 @@ under the License.
>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>> + <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>> </catalog>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

> 
>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>> @@ -42,6 +42,7 @@ under the License.
>> <xs:simpleContent>
>> <xs:extension base="xs:string">
>> <xs:attribute ref="xml:lang"/>
>> + <xs:attribute ref="xml:space"/>
>> </xs:extension>
>> </xs:simpleContent>
>> </xs:complexType>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

> 
>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>> @@ -158,20 +158,26 @@ public class UtilXml {
>> 
>> // ----- TrAX Methods ----------------- //
>> 
>> - /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>> - * XML document. This method is provided as an alternative to the
>> - * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>> + * <code>org.apache.xml.serialize.OutputFormat</code> class.
>> + * 
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> * @return A <code>Transformer</code> instance
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerConfigurationException
>> */
>> - public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>> + public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>> + throws TransformerConfigurationException {
>> StringBuilder sb = new StringBuilder();
>> sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>> sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>> @@ -189,7 +195,11 @@ public class UtilXml {
>> sb.append(indentAmount <= 0 ? 4 : indentAmount);
>> sb.append("\"");
>> }
>> - sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + if (keepSpace) {
>> + sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>> + } else {
>> + sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + }
>> sb.append("<xsl:template match=\"@*|node()\">\n");
>> sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>> sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>> @@ -212,21 +222,29 @@ public class UtilXml {
>> transformer.transform(source, result);
>> }
>> 
>> - /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>> - * using JAXP TrAX.
>> - * @param node The <code>Node</code> to serialize
>> - * @param os The <code>OutputStream</code> to serialize to
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>> + * 
>> + * @param node
>> + * The <code>Node</code> to serialize
>> + * @param os
>> + * The <code>OutputStream</code> to serialize to
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerException
>> */
>> - public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>> - Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>> + public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>> + boolean keepSpace) throws TransformerException {
>> + Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>> transformDomDocument(transformer, node, os);
>> }
>> 
>> @@ -325,9 +343,9 @@ public class UtilXml {
>> return;
>> }
>> // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>> - // charset = UTF-8, line width = 72
>> + // charset = UTF-8, line width = 72, strip spaces
>> try {
>> - writeXmlDocument(node, os, "UTF-8", false, true, 4);
>> + writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>> } catch (TransformerException e) {
>> // Wrapping this exception for backwards compatibility
>> throw new IOException(e.getMessage());
>> 
>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

> 
>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>> @@ -8,6 +8,7 @@
>> to you under the Apache License, Version 2.0 (the
>> "License"); you may not use this file except in compliance
>> with the License. You may obtain a copy of the License at
>> +
>> http://www.apache.org/licenses/LICENSE-2.0
>> 
>> Unless required by applicable law or agreed to in writing,
>> @@ -17,13 +18,13 @@
>> specific language governing permissions and limitations
>> under the License.
>> -->
>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>> <property key="AP">
>> <value xml:lang="de">Kreditoren</value>
>> <value xml:lang="en">AP</value>
>> <value xml:lang="es">Compras</value>
>> <value xml:lang="fr">Cpt. fourn.</value>
>> - <value xml:lang="hi_IN">लेखा देय</value>
>> + <value xml:lang="hi-IN">लेखा देय</value>
>> <value xml:lang="it">AP</value>
>> <value xml:lang="nl">Schulden</value>
>> <value xml:lang="pt_BR">Contas a pagar</value>
>> @@ -127,6 +128,7 @@
>> <property key="CommonAbort">
>> <value xml:lang="en">Abort</value>
>> <value xml:lang="es">Cancelar</value>
>> + <value xml:lang="fr">Abandonner</value>
>> <value xml:lang="vi">Hủy</value>
>> </property>
>> <property key="CommonAccepted">
>> @@ -413,6 +415,7 @@
>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>> <value xml:lang="en">Address not found.</value>
>> <value xml:lang="es">Dirección no encontrada.</value>
>> + <value xml:lang="fr">Adresse inconnue</value>
>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>> </property>
>> <property key="CommonAddresses">
>> @@ -2770,7 +2773,8 @@
>> <value xml:lang="zh_TW">電�郵件</value>
>> </property>
>> <property key="CommonEmptyHeader">
>> - <value xml:lang="en" xml:space="preserve"> </value><!-- do not remove this! -->
>> + <!-- do not remove this! -->
>> + <value xml:lang="en" xml:space="preserve"> </value>
>> </property>
>> <property key="CommonEnable">
>> <value xml:lang="en">Enable</value>
>> @@ -11081,6 +11085,31 @@
>> <value xml:lang="zh">有效日期</value>
>> <value xml:lang="zh_TW">有效日</value>
>> </property>
>> + <property key="FormFieldTitle_expireButton">
>> + <value xml:lang="ar">نهاية الصلاحية</value>
>> + <value xml:lang="cs">Vypršet</value>
>> + <value xml:lang="de">Ablaufen</value>
>> + <value xml:lang="en">Expire</value>
>> + <value xml:lang="es">Expiración</value>
>> + <value xml:lang="fr">Invalider</value>
>> + <value xml:lang="hi-IN">निश�वासन</value>
>> + <value xml:lang="it">Scade</value>
>> + <value xml:lang="nl">Maak verlopen</value>
>> + <value xml:lang="pt">Expirar</value>
>> + <value xml:lang="pt-PT">Terminar</value>
>> + <value xml:lang="ro">Expira</value>
>> + <value xml:lang="ru">Прекратить</value>
>> + <value xml:lang="th">หมดเขต</value>
>> + <value xml:lang="vi">Hết hạn</value>
>> + <value xml:lang="zh">过期</value>
>> + <value xml:lang="zh-CN">过期</value>
>> + <value xml:lang="zh-TW">�期</value>
>> + </property>
>> + <property key="FormFieldTitle_extDevicePurposeActionId">
>> + <value xml:lang="en">External Device Purpose Action Id</value>
>> + <value xml:lang="es">Código acción dispositivo externo</value>
>> + <value xml:lang="fr">Obj. de l'action</value>
>> + </property>
>> <property key="FormFieldTitle_externalDeviceId">
>> <value xml:lang="en">External Device Id</value>
>> <value xml:lang="es">Código dispositivo externo</value>
>> @@ -11091,11 +11120,6 @@
>> <value xml:lang="es">Código tipo dispositivo externo</value>
>> <value xml:lang="fr">Type de Mat. Externe</value>
>> </property>
>> - <property key="FormFieldTitle_extDevicePurposeActionId">
>> - <value xml:lang="en">External Device Purpose Action Id</value>
>> - <value xml:lang="es">Código acción dispositivo externo</value>
>> - <value xml:lang="fr">Obj. de l'action</value>
>> - </property>
>> <property key="FormFieldTitle_fromDate">
>> <value xml:lang="ar">تاريخ البدء</value>
>> <value xml:lang="de">Von Datum</value>
>> 
>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>_____________________________________________

> 
>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.UtilXml;
>> import org.ofbiz.base.util.cache.UtilCache;
>> -
>> import org.ofbiz.service.DispatchContext;
>> import org.ofbiz.service.ServiceUtil;
>> -
>> import org.w3c.dom.Comment;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>> if (apacheLicenseText != null) {
>> fos.write(apacheLicenseText.getBytes());
>> }
>> - UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>> + UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>> } finally {
>> fos.close();
>> // clear cache to see immediately the new labels and
>> 
>> 
> 
> 



Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Yeah sure, it's a *general* rule of thumb.  Your changes have been discussed and agreed upon, besides I don't think they involved changing public method signatures in a breaking way.

Regards
Scott

On 16/05/2012, at 1:22 PM, Adam Heath wrote:

> Except that I *am* planning on backporting the delegator changes, as it does simplify the api, and makes it easier to backport other changes. But only to 12.04, as that hasn't really been released yet.
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
> 
> Scott Gray <sc...@hotwaxmedia.com> wrote:
> 
> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method. Obviously deprecation shouldn't be back-ported.
> 
> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
> 
> Regards
> Scott
> 
> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
> 
>> Author: jleroux
>> Date: Tue May 15 19:11:13 2012
>> New Revision: 1338836
>> 
>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>> Log:
>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>> _____________________________________________
> 
>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>> 
>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
>> * Adds the xml:space attribute into the valueType complexType
>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>> 
>> I got an issue when 1st trying to commit: 
>> Commit failed (details follow):
>> While preparing
>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>> Inconsistent line ending style
>> 
>> So I forced the EOLs to my locale platform value (Win XP)
>> _____________________________________________
> 
>> 
>> 
>> Modified:
>> ofbiz/branches/release12.04/ (props changed)
>> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> 
>> Propchange: ofbiz/branches/release12.04/
>> _____________________________________________
> 
>> Merged /ofbiz/trunk:r1338831
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> _____________________________________________
> 
>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>> @@ -29,4 +29,5 @@ under the License.
>> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>> + <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>> </catalog>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>> _____________________________________________
> 
>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>> @@ -42,6 +42,7 @@ under the License.
>> <xs:simpleContent>
>> <xs:extension base="xs:string">
>> <xs:attribute ref="xml:lang"/>
>> + <xs:attribute ref="xml:space"/>
>> </xs:extension>
>> </xs:simpleContent>
>> </xs:complexType>
>> 
>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> _____________________________________________
> 
>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>> @@ -158,20 +158,26 @@ public class UtilXml {
>> 
>> // ----- TrAX Methods ----------------- //
>> 
>> - /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>> - * XML document. This method is provided as an alternative to the
>> - * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>> + * <code>org.apache.xml.serialize.OutputFormat</code> class.
>> + * 
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> * @return A <code>Transformer</code> instance
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerConfigurationException
>> */
>> - public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>> + public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>> + throws TransformerConfigurationException {
>> StringBuilder sb = new StringBuilder();
>> sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>> sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>> @@ -189,7 +195,11 @@ public class UtilXml {
>> sb.append(indentAmount <= 0 ? 4 : indentAmount);
>> sb.append("\"");
>> }
>> - sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + if (keepSpace) {
>> + sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>> + } else {
>> + sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> + }
>> sb.append("<xsl:template match=\"@*|node()\">\n");
>> sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>> sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>> @@ -212,21 +222,29 @@ public class UtilXml {
>> transformer.transform(source, result);
>> }
>> 
>> - /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>> - * using JAXP TrAX.
>> - * @param node The <code>Node</code> to serialize
>> - * @param os The <code>OutputStream</code> to serialize to
>> - * @param encoding Optional encoding, defaults to UTF-8
>> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> - * will be omitted from the output
>> - * @param indent If <code>true</code>, the output will be indented
>> - * @param indentAmount If <code>indent</code> is <code>true</code>,
>> - * the number of spaces to indent. Default is 4.
>> + /**
>> + * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>> + * 
>> + * @param node
>> + * The <code>Node</code> to serialize
>> + * @param os
>> + * The <code>OutputStream</code> to serialize to
>> + * @param encoding
>> + * Optional encoding, defaults to UTF-8
>> + * @param omitXmlDeclaration
>> + * If <code>true</code> the xml declaration will be omitted from the output
>> + * @param keepSpace
>> + * If <code>true</code> spaces are preserved, else striped
>> + * @param indent
>> + * If <code>true</code>, the output will be indented
>> + * @param indentAmount
>> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>> * @throws TransformerException
>> */
>> - public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>> - Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>> + public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>> + boolean keepSpace) throws TransformerException {
>> + Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>> transformDomDocument(transformer, node, os);
>> }
>> 
>> @@ -325,9 +343,9 @@ public class UtilXml {
>> return;
>> }
>> // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>> - // charset = UTF-8, line width = 72
>> + // charset = UTF-8, line width = 72, strip spaces
>> try {
>> - writeXmlDocument(node, os, "UTF-8", false, true, 4);
>> + writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>> } catch (TransformerException e) {
>> // Wrapping this exception for backwards compatibility
>> throw new IOException(e.getMessage());
>> 
>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> _____________________________________________
> 
>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>> @@ -8,6 +8,7 @@
>> to you under the Apache License, Version 2.0 (the
>> "License"); you may not use this file except in compliance
>> with the License. You may obtain a copy of the License at
>> +
>> http://www.apache.org/licenses/LICENSE-2.0
>> 
>> Unless required by applicable law or agreed to in writing,
>> @@ -17,13 +18,13 @@
>> specific language governing permissions and limitations
>> under the License.
>> -->
>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>> <property key="AP">
>> <value xml:lang="de">Kreditoren</value>
>> <value xml:lang="en">AP</value>
>> <value xml:lang="es">Compras</value>
>> <value xml:lang="fr">Cpt. fourn.</value>
>> - <value xml:lang="hi_IN">लेखा देय</value>
>> + <value xml:lang="hi-IN">लेखा देय</value>
>> <value xml:lang="it">AP</value>
>> <value xml:lang="nl">Schulden</value>
>> <value xml:lang="pt_BR">Contas a pagar</value>
>> @@ -127,6 +128,7 @@
>> <property key="CommonAbort">
>> <value xml:lang="en">Abort</value>
>> <value xml:lang="es">Cancelar</value>
>> + <value xml:lang="fr">Abandonner</value>
>> <value xml:lang="vi">Hủy</value>
>> </property>
>> <property key="CommonAccepted">
>> @@ -413,6 +415,7 @@
>> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>> <value xml:lang="en">Address not found.</value>
>> <value xml:lang="es">Dirección no encontrada.</value>
>> + <value xml:lang="fr">Adresse inconnue</value>
>> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
>> </property>
>> <property key="CommonAddresses">
>> @@ -2770,7 +2773,8 @@
>> <value xml:lang="zh_TW">電�郵件</value>
>> </property>
>> <property key="CommonEmptyHeader">
>> - <value xml:lang="en" xml:space="preserve"> </value><!-- do not remove this! -->
>> + <!-- do not remove this! -->
>> + <value xml:lang="en" xml:space="preserve"> </value>
>> </property>
>> <property key="CommonEnable">
>> <value xml:lang="en">Enable</value>
>> @@ -11081,6 +11085,31 @@
>> <value xml:lang="zh">有效日期</value>
>> <value xml:lang="zh_TW">有效日</value>
>> </property>
>> + <property key="FormFieldTitle_expireButton">
>> + <value xml:lang="ar">نهاية الصلاحية</value>
>> + <value xml:lang="cs">Vypršet</value>
>> + <value xml:lang="de">Ablaufen</value>
>> + <value xml:lang="en">Expire</value>
>> + <value xml:lang="es">Expiración</value>
>> + <value xml:lang="fr">Invalider</value>
>> + <value xml:lang="hi-IN">निश�वासन</value>
>> + <value xml:lang="it">Scade</value>
>> + <value xml:lang="nl">Maak verlopen</value>
>> + <value xml:lang="pt">Expirar</value>
>> + <value xml:lang="pt-PT">Terminar</value>
>> + <value xml:lang="ro">Expira</value>
>> + <value xml:lang="ru">Прекратить</value>
>> + <value xml:lang="th">หมดเขต</value>
>> + <value xml:lang="vi">Hết hạn</value>
>> + <value xml:lang="zh">过期</value>
>> + <value xml:lang="zh-CN">过期</value>
>> + <value xml:lang="zh-TW">�期</value>
>> + </property>
>> + <property key="FormFieldTitle_extDevicePurposeActionId">
>> + <value xml:lang="en">External Device Purpose Action Id</value>
>> + <value xml:lang="es">Código acción dispositivo externo</value>
>> + <value xml:lang="fr">Obj. de l'action</value>
>> + </property>
>> <property key="FormFieldTitle_externalDeviceId">
>> <value xml:lang="en">External Device Id</value>
>> <value xml:lang="es">Código dispositivo externo</value>
>> @@ -11091,11 +11120,6 @@
>> <value xml:lang="es">Código tipo dispositivo externo</value>
>> <value xml:lang="fr">Type de Mat. Externe</value>
>> </property>
>> - <property key="FormFieldTitle_extDevicePurposeActionId">
>> - <value xml:lang="en">External Device Purpose Action Id</value>
>> - <value xml:lang="es">Código acción dispositivo externo</value>
>> - <value xml:lang="fr">Obj. de l'action</value>
>> - </property>
>> <property key="FormFieldTitle_fromDate">
>> <value xml:lang="ar">تاريخ البدء</value>
>> <value xml:lang="de">Von Datum</value>
>> 
>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> _____________________________________________
> 
>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.UtilXml;
>> import org.ofbiz.base.util.cache.UtilCache;
>> -
>> import org.ofbiz.service.DispatchContext;
>> import org.ofbiz.service.ServiceUtil;
>> -
>> import org.w3c.dom.Comment;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>> if (apacheLicenseText != null) {
>> fos.write(apacheLicenseText.getBytes());
>> }
>> - UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>> + UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>> } finally {
>> fos.close();
>> // clear cache to see immediately the new labels and
>> 
>> 
> 
> 


Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adam Heath <do...@brainfood.com>.
Except that I *am* planning on backporting the delegator changes, as it does simplify the api, and makes it easier to backport other changes. But only to 12.04, as that hasn't really been released yet.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Scott Gray <sc...@hotwaxmedia.com> wrote:

You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method. Obviously deprecation shouldn't be back-ported.

There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.

Regards
Scott

On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:

> Author: jleroux
> Date: Tue May 15 19:11:13 2012
> New Revision: 1338836
> 
> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
> Log:
> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>_____________________________________________

> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
> 
> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality 
> * Adds the xml:space attribute into the valueType complexType
> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
> 
> I got an issue when 1st trying to commit: 
> Commit failed (details follow):
> While preparing
> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
> Inconsistent line ending style
> 
> So I forced the EOLs to my locale platform value (Win XP)
>_____________________________________________

> 
> 
> Modified:
> ofbiz/branches/release12.04/ (props changed)
> ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
> ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
> ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
> ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
> ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> 
> Propchange: ofbiz/branches/release12.04/
>_____________________________________________

> Merged /ofbiz/trunk:r1338831
> 
> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>_____________________________________________

> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
> @@ -29,4 +29,5 @@ under the License.
> <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
> <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
> + <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
> </catalog>
> 
> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>_____________________________________________

> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
> @@ -42,6 +42,7 @@ under the License.
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute ref="xml:lang"/>
> + <xs:attribute ref="xml:space"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> 
> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>_____________________________________________

> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
> @@ -158,20 +158,26 @@ public class UtilXml {
> 
> // ----- TrAX Methods ----------------- //
> 
> - /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
> - * XML document. This method is provided as an alternative to the
> - * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
> - * @param encoding Optional encoding, defaults to UTF-8
> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
> - * will be omitted from the output
> - * @param indent If <code>true</code>, the output will be indented
> - * @param indentAmount If <code>indent</code> is <code>true</code>,
> - * the number of spaces to indent. Default is 4.
> + /**
> + * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
> + * <code>org.apache.xml.serialize.OutputFormat</code> class.
> + * 
> + * @param encoding
> + * Optional encoding, defaults to UTF-8
> + * @param omitXmlDeclaration
> + * If <code>true</code> the xml declaration will be omitted from the output
> + * @param indent
> + * If <code>true</code>, the output will be indented
> + * @param indentAmount
> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
> + * @param keepSpace
> + * If <code>true</code> spaces are preserved, else striped
> * @return A <code>Transformer</code> instance
> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
> * @throws TransformerConfigurationException
> */
> - public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
> + public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
> + throws TransformerConfigurationException {
> StringBuilder sb = new StringBuilder();
> sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
> sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
> @@ -189,7 +195,11 @@ public class UtilXml {
> sb.append(indentAmount <= 0 ? 4 : indentAmount);
> sb.append("\"");
> }
> - sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
> + if (keepSpace) {
> + sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
> + } else {
> + sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
> + }
> sb.append("<xsl:template match=\"@*|node()\">\n");
> sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
> sb.append("</xsl:template>\n</xsl:stylesheet>\n");
> @@ -212,21 +222,29 @@ public class UtilXml {
> transformer.transform(source, result);
> }
> 
> - /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
> - * using JAXP TrAX.
> - * @param node The <code>Node</code> to serialize
> - * @param os The <code>OutputStream</code> to serialize to
> - * @param encoding Optional encoding, defaults to UTF-8
> - * @param omitXmlDeclaration If <code>true</code> the xml declaration
> - * will be omitted from the output
> - * @param indent If <code>true</code>, the output will be indented
> - * @param indentAmount If <code>indent</code> is <code>true</code>,
> - * the number of spaces to indent. Default is 4.
> + /**
> + * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
> + * 
> + * @param node
> + * The <code>Node</code> to serialize
> + * @param os
> + * The <code>OutputStream</code> to serialize to
> + * @param encoding
> + * Optional encoding, defaults to UTF-8
> + * @param omitXmlDeclaration
> + * If <code>true</code> the xml declaration will be omitted from the output
> + * @param keepSpace
> + * If <code>true</code> spaces are preserved, else striped
> + * @param indent
> + * If <code>true</code>, the output will be indented
> + * @param indentAmount
> + * If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
> * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
> * @throws TransformerException
> */
> - public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
> - Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
> + public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
> + boolean keepSpace) throws TransformerException {
> + Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
> transformDomDocument(transformer, node, os);
> }
> 
> @@ -325,9 +343,9 @@ public class UtilXml {
> return;
> }
> // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
> - // charset = UTF-8, line width = 72
> + // charset = UTF-8, line width = 72, strip spaces
> try {
> - writeXmlDocument(node, os, "UTF-8", false, true, 4);
> + writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
> } catch (TransformerException e) {
> // Wrapping this exception for backwards compatibility
> throw new IOException(e.getMessage());
> 
> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>_____________________________________________

> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
> @@ -8,6 +8,7 @@
> to you under the Apache License, Version 2.0 (the
> "License"); you may not use this file except in compliance
> with the License. You may obtain a copy of the License at
> +
> http://www.apache.org/licenses/LICENSE-2.0
> 
> Unless required by applicable law or agreed to in writing,
> @@ -17,13 +18,13 @@
> specific language governing permissions and limitations
> under the License.
> -->
> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
> <property key="AP">
> <value xml:lang="de">Kreditoren</value>
> <value xml:lang="en">AP</value>
> <value xml:lang="es">Compras</value>
> <value xml:lang="fr">Cpt. fourn.</value>
> - <value xml:lang="hi_IN">लेखा देय</value>
> + <value xml:lang="hi-IN">लेखा देय</value>
> <value xml:lang="it">AP</value>
> <value xml:lang="nl">Schulden</value>
> <value xml:lang="pt_BR">Contas a pagar</value>
> @@ -127,6 +128,7 @@
> <property key="CommonAbort">
> <value xml:lang="en">Abort</value>
> <value xml:lang="es">Cancelar</value>
> + <value xml:lang="fr">Abandonner</value>
> <value xml:lang="vi">Hủy</value>
> </property>
> <property key="CommonAccepted">
> @@ -413,6 +415,7 @@
> <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
> <value xml:lang="en">Address not found.</value>
> <value xml:lang="es">Dirección no encontrada.</value>
> + <value xml:lang="fr">Adresse inconnue</value>
> <value xml:lang="vi">Không tìm thấy địa chỉ</value>
> </property>
> <property key="CommonAddresses">
> @@ -2770,7 +2773,8 @@
> <value xml:lang="zh_TW">電�郵件</value>
> </property>
> <property key="CommonEmptyHeader">
> - <value xml:lang="en" xml:space="preserve"> </value><!-- do not remove this! -->
> + <!-- do not remove this! -->
> + <value xml:lang="en" xml:space="preserve"> </value>
> </property>
> <property key="CommonEnable">
> <value xml:lang="en">Enable</value>
> @@ -11081,6 +11085,31 @@
> <value xml:lang="zh">有效日期</value>
> <value xml:lang="zh_TW">有效日</value>
> </property>
> + <property key="FormFieldTitle_expireButton">
> + <value xml:lang="ar">نهاية الصلاحية</value>
> + <value xml:lang="cs">Vypršet</value>
> + <value xml:lang="de">Ablaufen</value>
> + <value xml:lang="en">Expire</value>
> + <value xml:lang="es">Expiración</value>
> + <value xml:lang="fr">Invalider</value>
> + <value xml:lang="hi-IN">निश�वासन</value>
> + <value xml:lang="it">Scade</value>
> + <value xml:lang="nl">Maak verlopen</value>
> + <value xml:lang="pt">Expirar</value>
> + <value xml:lang="pt-PT">Terminar</value>
> + <value xml:lang="ro">Expira</value>
> + <value xml:lang="ru">Прекратить</value>
> + <value xml:lang="th">หมดเขต</value>
> + <value xml:lang="vi">Hết hạn</value>
> + <value xml:lang="zh">过期</value>
> + <value xml:lang="zh-CN">过期</value>
> + <value xml:lang="zh-TW">�期</value>
> + </property>
> + <property key="FormFieldTitle_extDevicePurposeActionId">
> + <value xml:lang="en">External Device Purpose Action Id</value>
> + <value xml:lang="es">Código acción dispositivo externo</value>
> + <value xml:lang="fr">Obj. de l'action</value>
> + </property>
> <property key="FormFieldTitle_externalDeviceId">
> <value xml:lang="en">External Device Id</value>
> <value xml:lang="es">Código dispositivo externo</value>
> @@ -11091,11 +11120,6 @@
> <value xml:lang="es">Código tipo dispositivo externo</value>
> <value xml:lang="fr">Type de Mat. Externe</value>
> </property>
> - <property key="FormFieldTitle_extDevicePurposeActionId">
> - <value xml:lang="en">External Device Purpose Action Id</value>
> - <value xml:lang="es">Código acción dispositivo externo</value>
> - <value xml:lang="fr">Obj. de l'action</value>
> - </property>
> <property key="FormFieldTitle_fromDate">
> <value xml:lang="ar">تاريخ البدء</value>
> <value xml:lang="de">Von Datum</value>
> 
> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>_____________________________________________

> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
> import org.ofbiz.base.util.UtilValidate;
> import org.ofbiz.base.util.UtilXml;
> import org.ofbiz.base.util.cache.UtilCache;
> -
> import org.ofbiz.service.DispatchContext;
> import org.ofbiz.service.ServiceUtil;
> -
> import org.w3c.dom.Comment;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
> if (apacheLicenseText != null) {
> fos.write(apacheLicenseText.getBytes());
> }
> - UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
> + UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
> } finally {
> fos.close();
> // clear cache to see immediately the new labels and
> 
> 



Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Adam Heath <do...@brainfood.com>.
On 05/15/2012 10:32 PM, Scott Gray wrote:
> You can add a method by the same name if you need to, but you can't change an existing method's signature.

1: Add new method.  Nothing broken, nothing calls new code.
2: Modify existing old method to use new method.  Old method using new 
method, new method is now tested.  This verifies that the interface for 
external callers hasn't broken.
3: Modify all *other* code to call new method.  This removes the use of 
the old method from internal code, in preparation for (6).
4: Deprecate old method.  This warnings existing developers to clear out 
their memory of how the software works, and use the new way.
5: wait until deprecated old method is in release branch
6: remove old method.

See how I've done the recent mass-delegator deprecations.  I'm 
fast-tracking some of the steps, but all the steps are still there.  And 
I'm still doing extensive testing, even reading the diffs many times.

So far, the commits I've done have existed since December, 2010, and 
there are additional lines I have to fix now.

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Ha yes, of course. I was blinded by my will to not duplicate createOutputTransformer() for only one word (preserve & strip) when I 
did not see that the DRY principle is lower than the constraints on backward compatibitlity. I will do that.

Jacques

From: "Scott Gray" <sc...@hotwaxmedia.com>
> You can add a method by the same name if you need to, but you can't change an existing method's signature.
>
> Regards
> Scott
>
> On 16/05/2012, at 3:27 PM, Jacques Le Roux wrote:
>
>> Mmm... but then how do you fix the bug in released branches?
>>
>> Jacques
>>
>> From: "Jacques Le Roux" <ja...@les7arts.com>
>>> Ha indeed, I have reverted R10.04 and R11.04. I will deprecate on trunk and R12.04
>>>
>>> Jacques
>>>
>>> From: "Scott Gray" <sc...@hotwaxmedia.com>
>>>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. 
>>>> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old 
>>>> method.  Obviously deprecation shouldn't be back-ported.
>>>>
>>>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>>>
>>>>> Author: jleroux
>>>>> Date: Tue May 15 19:11:13 2012
>>>>> New Revision: 1338836
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>>> Log:
>>>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>>>> ------------------------------------------------------------------------
>>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>>>
>>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into 
>>>>> UtilXml.createOutputTransformer()
>>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>>>> * Adds the xml:space attribute into the valueType complexType
>>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>>>
>>>>> I got an issue when 1st trying to commit:
>>>>> Commit failed (details follow):
>>>>> While preparing
>>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>>>> Inconsistent line ending style
>>>>>
>>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>>> ------------------------------------------------------------------------
>>>>> 
>>>>>
>>>>> Modified:
>>>>>   ofbiz/branches/release12.04/   (props changed)
>>>>>   ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>>   ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>>   ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>>   ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>>   ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>>
>>>>> Propchange: ofbiz/branches/release12.04/
>>>>> ------------------------------------------------------------------------------
>>>>> Merged /ofbiz/trunk:r1338831
>>>>>
>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>>>> @@ -29,4 +29,5 @@ under the License.
>>>>>    <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>>>> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>>>> </catalog>
>>>>>
>>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>>>> @@ -42,6 +42,7 @@ under the License.
>>>>>        <xs:simpleContent>
>>>>>            <xs:extension base="xs:string">
>>>>>                <xs:attribute ref="xml:lang"/>
>>>>> +                <xs:attribute ref="xml:space"/>
>>>>>            </xs:extension>
>>>>>        </xs:simpleContent>
>>>>>    </xs:complexType>
>>>>>
>>>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>>>
>>>>>    // ----- TrAX Methods ----------------- //
>>>>>
>>>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>>>> -     * XML document. This method is provided as an alternative to the
>>>>> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>>>> -     * will be omitted from the output
>>>>> -     * @param indent If <code>true</code>, the output will be indented
>>>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>>>> -     * the number of spaces to indent. Default is 4.
>>>>> +    /**
>>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an 
>>>>> alternative to the deprecated
>>>>> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
>>>>> +     *
>>>>> +     * @param encoding
>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>> +     * @param omitXmlDeclaration
>>>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>>>> +     * @param indent
>>>>> +     *            If <code>true</code>, the output will be indented
>>>>> +     * @param indentAmount
>>>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>>>> +     * @param keepSpace
>>>>> +     *            If <code>true</code> spaces are preserved, else striped
>>>>>     * @return A <code>Transformer</code> instance
>>>>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>     * @throws TransformerConfigurationException
>>>>>     */
>>>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>>>>> indentAmount) throws TransformerConfigurationException {
>>>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>>>>> indentAmount, boolean keepSpace)
>>>>> +            throws TransformerConfigurationException {
>>>>>        StringBuilder sb = new StringBuilder();
>>>>>        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>>        sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" 
>>>>> xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>>            sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>>>>            sb.append("\"");
>>>>>        }
>>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>> +        if (keepSpace) {
>>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>>> +        } else {
>>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>>> +        }
>>>>>        sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>>        sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>>>        sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>>        transformer.transform(source, result);
>>>>>    }
>>>>>
>>>>> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>>>>> -     * using JAXP TrAX.
>>>>> -     * @param node The <code>Node</code> to serialize
>>>>> -     * @param os The <code>OutputStream</code> to serialize to
>>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>>>> -     * will be omitted from the output
>>>>> -     * @param indent If <code>true</code>, the output will be indented
>>>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>>>> -     * the number of spaces to indent. Default is 4.
>>>>> +    /**
>>>>> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>>>>> +     *
>>>>> +     * @param node
>>>>> +     *            The <code>Node</code> to serialize
>>>>> +     * @param os
>>>>> +     *            The <code>OutputStream</code> to serialize to
>>>>> +     * @param encoding
>>>>> +     *            Optional encoding, defaults to UTF-8
>>>>> +     * @param omitXmlDeclaration
>>>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>>>> +     * @param keepSpace
>>>>> +     *            If <code>true</code> spaces are preserved, else striped
>>>>> +     * @param indent
>>>>> +     *            If <code>true</code>, the output will be indented
>>>>> +     * @param indentAmount
>>>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>>>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>>     * @throws TransformerException
>>>>>     */
>>>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean 
>>>>> indent, int indentAmount) throws TransformerException {
>>>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean 
>>>>> indent, int indentAmount,
>>>>> +            boolean keepSpace) throws TransformerException {
>>>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>>        transformDomDocument(transformer, node, os);
>>>>>    }
>>>>>
>>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>>            return;
>>>>>        }
>>>>>        // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>>>> -        // charset = UTF-8, line width = 72
>>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>>        try {
>>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>>>        } catch (TransformerException e) {
>>>>>            // Wrapping this exception for backwards compatibility
>>>>>            throw new IOException(e.getMessage());
>>>>>
>>>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>>>> @@ -8,6 +8,7 @@
>>>>>    to you under the Apache License, Version 2.0 (the
>>>>>    "License"); you may not use this file except in compliance
>>>>>    with the License.  You may obtain a copy of the License at
>>>>> +
>>>>>    http://www.apache.org/licenses/LICENSE-2.0
>>>>>
>>>>>    Unless required by applicable law or agreed to in writing,
>>>>> @@ -17,13 +18,13 @@
>>>>>    specific language governing permissions and limitations
>>>>>    under the License.
>>>>> -->
>>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>>    <property key="AP">
>>>>>        <value xml:lang="de">Kreditoren</value>
>>>>>        <value xml:lang="en">AP</value>
>>>>>        <value xml:lang="es">Compras</value>
>>>>>        <value xml:lang="fr">Cpt. fourn.</value>
>>>>> -        <value xml:lang="hi_IN">औà¥?à¤-à¤≤ जà¥?य</value>
>>>>> +        <value xml:lang="hi-IN">औà¥?à¤-à¤≤ जà¥?य</value>
>>>>>        <value xml:lang="it">AP</value>
>>>>>        <value xml:lang="nl">Schulden</value>
>>>>>        <value xml:lang="pt_BR">Contas a pagar</value>
>>>>> @@ -127,6 +128,7 @@
>>>>>    <property key="CommonAbort">
>>>>>        <value xml:lang="en">Abort</value>
>>>>>        <value xml:lang="es">Cancelar</value>
>>>>> +        <value xml:lang="fr">Abandonner</value>
>>>>>        <value xml:lang="vi">Hủy</value>
>>>>>    </property>
>>>>>    <property key="CommonAccepted">
>>>>> @@ -413,6 +415,7 @@
>>>>>        <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>>        <value xml:lang="en">Address not found.</value>
>>>>>        <value xml:lang="es">DirecciÓn no encontrada.</value>
>>>>> +        <value xml:lang="fr">Adresse inconnue</value>
>>>>>        <value xml:lang="vi">Không tìm thấy Ä'á» >>     </property>
>>>>>    <property key="CommonAddresses">
>>>>> @@ -2770,7 +2773,8 @@
>>>>>        <value xml:lang="zh_TW">é>»å–∆éfµä»¶</value>
>>>>>    </property>
>>>>>    <property key="CommonEmptyHeader">
>>>>> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>>>>> +        <!-- do not  remove this! -->
>>>>> +        <value xml:lang="en" xml:space="preserve"> </value>
>>>>>    </property>
>>>>>    <property key="CommonEnable">
>>>>>        <value xml:lang="en">Enable</value>
>>>>> @@ -11081,6 +11085,31 @@
>>>>>        <value xml:lang="zh">æo?æ.^æ-¥æoY</value>
>>>>>        <value xml:lang="zh_TW">æo?æ.^æ-¥</value>
>>>>>    </property>
>>>>> +    <property key="FormFieldTitle_expireButton">
>>>>> +        <value xml:lang="ar">Ù?Ù?اÙSØ© اÙ"صÙ"اؖÙSØ©</value>
>>>>> +        <value xml:lang="cs">Vypršet</value>
>>>>> +        <value xml:lang="de">Ablaufen</value>
>>>>> +        <value xml:lang="en">Expire</value>
>>>>> +        <value xml:lang="es">ExpiraciÓn</value>
>>>>> +        <value xml:lang="fr">Invalider</value>
>>>>> +        <value xml:lang="hi-IN">निशय़वà¤≤सन</value>
>>>>> +        <value xml:lang="it">Scade</value>
>>>>> +        <value xml:lang="nl">Maak verlopen</value>
>>>>> +        <value xml:lang="pt">Expirar</value>
>>>>> +        <value xml:lang="pt-PT">Terminar</value>
>>>>> +        <value xml:lang="ro">Expira</value>
>>>>> +        <value xml:lang="ru">‹YÑ?‹µ‹ºÑ?‹°Ñ,‹¸Ñ,ÑO</value>
>>>>> +        <value xml:lang="th">หมà¸"à’?à¸,à¸.</value>
>>>>> +        <value xml:lang="vi">Hết hạn</value>
>>>>> +        <value xml:lang="zh">è¿?æoY</value>
>>>>> +        <value xml:lang="zh-CN">è¿?æoY</value>
>>>>> +        <value xml:lang="zh-TW">é™ZæoY</value>
>>>>> +    </property>
>>>>> +    <property key="FormFieldTitle_extDevicePurposeActionId">
>>>>> +        <value xml:lang="en">External Device Purpose Action Id</value>
>>>>> +        <value xml:lang="es">CÓdigo acciÓn dispositivo externo</value>
>>>>> +        <value xml:lang="fr">Obj. de l'action</value>
>>>>> +    </property>
>>>>>    <property key="FormFieldTitle_externalDeviceId">
>>>>>        <value xml:lang="en">External Device Id</value>
>>>>>        <value xml:lang="es">CÓdigo dispositivo externo</value>
>>>>> @@ -11091,11 +11120,6 @@
>>>>>        <value xml:lang="es">CÓdigo tipo dispositivo externo</value>
>>>>>        <value xml:lang="fr">Type de Mat. Externe</value>
>>>>>    </property>
>>>>> -    <property key="FormFieldTitle_extDevicePurposeActionId">
>>>>> -        <value xml:lang="en">External Device Purpose Action Id</value>
>>>>> -        <value xml:lang="es">CÓdigo acciÓn dispositivo externo</value>
>>>>> -        <value xml:lang="fr">Obj. de l'action</value>
>>>>> -    </property>
>>>>>    <property key="FormFieldTitle_fromDate">
>>>>>        <value xml:lang="ar">تارÙSØ® اÙ"بدء</value>
>>>>>        <value xml:lang="de">Von Datum</value>
>>>>>
>>>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 
>>>>> 19:11:13 2012
>>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> import org.ofbiz.base.util.UtilXml;
>>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>>> -
>>>>> import org.ofbiz.service.DispatchContext;
>>>>> import org.ofbiz.service.ServiceUtil;
>>>>> -
>>>>> import org.w3c.dom.Comment;
>>>>> import org.w3c.dom.Document;
>>>>> import org.w3c.dom.Element;
>>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>>                        if (apacheLicenseText != null) {
>>>>>                            fos.write(apacheLicenseText.getBytes());
>>>>>                        }
>>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>>                    } finally {
>>>>>                        fos.close();
>>>>>                        // clear cache to see immediately the new labels and
>>>>>
>>>>>
>>>>
>
> 

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
You can add a method by the same name if you need to, but you can't change an existing method's signature.

Regards
Scott

On 16/05/2012, at 3:27 PM, Jacques Le Roux wrote:

> Mmm... but then how do you fix the bug in released branches?
> 
> Jacques
> 
> From: "Jacques Le Roux" <ja...@les7arts.com>
>> Ha indeed, I have reverted R10.04 and R11.04. I will deprecate on trunk and R12.04
>> 
>> Jacques
>> 
>> From: "Scott Gray" <sc...@hotwaxmedia.com>
>>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old method.  Obviously deprecation shouldn't be back-ported.
>>> 
>>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>>> 
>>> Regards
>>> Scott
>>> 
>>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>> 
>>>> Author: jleroux
>>>> Date: Tue May 15 19:11:13 2012
>>>> New Revision: 1338836
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>>> Log:
>>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>>> ------------------------------------------------------------------------
>>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>> 
>>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into UtilXml.createOutputTransformer()
>>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>>> * Adds the xml:space attribute into the valueType complexType
>>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>> 
>>>> I got an issue when 1st trying to commit:
>>>> Commit failed (details follow):
>>>> While preparing
>>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>>> Inconsistent line ending style
>>>> 
>>>> So I forced the EOLs to my locale platform value (Win XP)
>>>> ------------------------------------------------------------------------
>>>> 
>>>> 
>>>> Modified:
>>>>   ofbiz/branches/release12.04/   (props changed)
>>>>   ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>>   ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>>   ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>>   ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>>   ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> 
>>>> Propchange: ofbiz/branches/release12.04/
>>>> ------------------------------------------------------------------------------
>>>> Merged /ofbiz/trunk:r1338831
>>>> 
>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>>> @@ -29,4 +29,5 @@ under the License.
>>>>    <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>>    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>>> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>>> </catalog>
>>>> 
>>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>>> @@ -42,6 +42,7 @@ under the License.
>>>>        <xs:simpleContent>
>>>>            <xs:extension base="xs:string">
>>>>                <xs:attribute ref="xml:lang"/>
>>>> +                <xs:attribute ref="xml:space"/>
>>>>            </xs:extension>
>>>>        </xs:simpleContent>
>>>>    </xs:complexType>
>>>> 
>>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>> 
>>>>    // ----- TrAX Methods ----------------- //
>>>> 
>>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>>> -     * XML document. This method is provided as an alternative to the
>>>> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If <code>true</code>, the output will be indented
>>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
>>>> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
>>>> +     *
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>>> +     * @param indent
>>>> +     *            If <code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>>> +     * @param keepSpace
>>>> +     *            If <code>true</code> spaces are preserved, else striped
>>>>     * @return A <code>Transformer</code> instance
>>>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>     * @throws TransformerConfigurationException
>>>>     */
>>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerConfigurationException {
>>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount, boolean keepSpace)
>>>> +            throws TransformerConfigurationException {
>>>>        StringBuilder sb = new StringBuilder();
>>>>        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>>        sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
>>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>>            sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>>>            sb.append("\"");
>>>>        }
>>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        if (keepSpace) {
>>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>>> +        } else {
>>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>>> +        }
>>>>        sb.append("<xsl:template match=\"@*|node()\">\n");
>>>>        sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>>        sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>>        transformer.transform(source, result);
>>>>    }
>>>> 
>>>> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>>>> -     * using JAXP TrAX.
>>>> -     * @param node The <code>Node</code> to serialize
>>>> -     * @param os The <code>OutputStream</code> to serialize to
>>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>>> -     * will be omitted from the output
>>>> -     * @param indent If <code>true</code>, the output will be indented
>>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>>> -     * the number of spaces to indent. Default is 4.
>>>> +    /**
>>>> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>>>> +     *
>>>> +     * @param node
>>>> +     *            The <code>Node</code> to serialize
>>>> +     * @param os
>>>> +     *            The <code>OutputStream</code> to serialize to
>>>> +     * @param encoding
>>>> +     *            Optional encoding, defaults to UTF-8
>>>> +     * @param omitXmlDeclaration
>>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>>> +     * @param keepSpace
>>>> +     *            If <code>true</code> spaces are preserved, else striped
>>>> +     * @param indent
>>>> +     *            If <code>true</code>, the output will be indented
>>>> +     * @param indentAmount
>>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>>>     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>>     * @throws TransformerException
>>>>     */
>>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) throws TransformerException {
>>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount,
>>>> +            boolean keepSpace) throws TransformerException {
>>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>>        transformDomDocument(transformer, node, os);
>>>>    }
>>>> 
>>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>>            return;
>>>>        }
>>>>        // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>>> -        // charset = UTF-8, line width = 72
>>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>>        try {
>>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>>        } catch (TransformerException e) {
>>>>            // Wrapping this exception for backwards compatibility
>>>>            throw new IOException(e.getMessage());
>>>> 
>>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>>> @@ -8,6 +8,7 @@
>>>>    to you under the Apache License, Version 2.0 (the
>>>>    "License"); you may not use this file except in compliance
>>>>    with the License.  You may obtain a copy of the License at
>>>> +
>>>>    http://www.apache.org/licenses/LICENSE-2.0
>>>> 
>>>>    Unless required by applicable law or agreed to in writing,
>>>> @@ -17,13 +18,13 @@
>>>>    specific language governing permissions and limitations
>>>>    under the License.
>>>> -->
>>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>>    <property key="AP">
>>>>        <value xml:lang="de">Kreditoren</value>
>>>>        <value xml:lang="en">AP</value>
>>>>        <value xml:lang="es">Compras</value>
>>>>        <value xml:lang="fr">Cpt. fourn.</value>
>>>> -        <value xml:lang="hi_IN">औà¥?à¤-à¤≤ जà¥?य</value>
>>>> +        <value xml:lang="hi-IN">औà¥?à¤-à¤≤ जà¥?य</value>
>>>>        <value xml:lang="it">AP</value>
>>>>        <value xml:lang="nl">Schulden</value>
>>>>        <value xml:lang="pt_BR">Contas a pagar</value>
>>>> @@ -127,6 +128,7 @@
>>>>    <property key="CommonAbort">
>>>>        <value xml:lang="en">Abort</value>
>>>>        <value xml:lang="es">Cancelar</value>
>>>> +        <value xml:lang="fr">Abandonner</value>
>>>>        <value xml:lang="vi">Hủy</value>
>>>>    </property>
>>>>    <property key="CommonAccepted">
>>>> @@ -413,6 +415,7 @@
>>>>        <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>>        <value xml:lang="en">Address not found.</value>
>>>>        <value xml:lang="es">DirecciÓn no encontrada.</value>
>>>> +        <value xml:lang="fr">Adresse inconnue</value>
>>>>        <value xml:lang="vi">Không tìm thấy Ä'á» >>     </property>
>>>>    <property key="CommonAddresses">
>>>> @@ -2770,7 +2773,8 @@
>>>>        <value xml:lang="zh_TW">é>»å–∆éfµä»¶</value>
>>>>    </property>
>>>>    <property key="CommonEmptyHeader">
>>>> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>>>> +        <!-- do not  remove this! -->
>>>> +        <value xml:lang="en" xml:space="preserve"> </value>
>>>>    </property>
>>>>    <property key="CommonEnable">
>>>>        <value xml:lang="en">Enable</value>
>>>> @@ -11081,6 +11085,31 @@
>>>>        <value xml:lang="zh">æo?æ.^æ-¥æoY</value>
>>>>        <value xml:lang="zh_TW">æo?æ.^æ-¥</value>
>>>>    </property>
>>>> +    <property key="FormFieldTitle_expireButton">
>>>> +        <value xml:lang="ar">Ù?Ù?اÙSØ© اÙ"صÙ"اؖÙSØ©</value>
>>>> +        <value xml:lang="cs">Vypršet</value>
>>>> +        <value xml:lang="de">Ablaufen</value>
>>>> +        <value xml:lang="en">Expire</value>
>>>> +        <value xml:lang="es">ExpiraciÓn</value>
>>>> +        <value xml:lang="fr">Invalider</value>
>>>> +        <value xml:lang="hi-IN">निशय़वà¤≤सन</value>
>>>> +        <value xml:lang="it">Scade</value>
>>>> +        <value xml:lang="nl">Maak verlopen</value>
>>>> +        <value xml:lang="pt">Expirar</value>
>>>> +        <value xml:lang="pt-PT">Terminar</value>
>>>> +        <value xml:lang="ro">Expira</value>
>>>> +        <value xml:lang="ru">‹YÑ?‹µ‹ºÑ?‹°Ñ,‹¸Ñ,ÑO</value>
>>>> +        <value xml:lang="th">หมà¸"à’?à¸,à¸.</value>
>>>> +        <value xml:lang="vi">Hết hạn</value>
>>>> +        <value xml:lang="zh">è¿?æoY</value>
>>>> +        <value xml:lang="zh-CN">è¿?æoY</value>
>>>> +        <value xml:lang="zh-TW">é™ZæoY</value>
>>>> +    </property>
>>>> +    <property key="FormFieldTitle_extDevicePurposeActionId">
>>>> +        <value xml:lang="en">External Device Purpose Action Id</value>
>>>> +        <value xml:lang="es">CÓdigo acciÓn dispositivo externo</value>
>>>> +        <value xml:lang="fr">Obj. de l'action</value>
>>>> +    </property>
>>>>    <property key="FormFieldTitle_externalDeviceId">
>>>>        <value xml:lang="en">External Device Id</value>
>>>>        <value xml:lang="es">CÓdigo dispositivo externo</value>
>>>> @@ -11091,11 +11120,6 @@
>>>>        <value xml:lang="es">CÓdigo tipo dispositivo externo</value>
>>>>        <value xml:lang="fr">Type de Mat. Externe</value>
>>>>    </property>
>>>> -    <property key="FormFieldTitle_extDevicePurposeActionId">
>>>> -        <value xml:lang="en">External Device Purpose Action Id</value>
>>>> -        <value xml:lang="es">CÓdigo acciÓn dispositivo externo</value>
>>>> -        <value xml:lang="fr">Obj. de l'action</value>
>>>> -    </property>
>>>>    <property key="FormFieldTitle_fromDate">
>>>>        <value xml:lang="ar">تارÙSØ® اÙ"بدء</value>
>>>>        <value xml:lang="de">Von Datum</value>
>>>> 
>>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 19:11:13 2012
>>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.base.util.UtilXml;
>>>> import org.ofbiz.base.util.cache.UtilCache;
>>>> -
>>>> import org.ofbiz.service.DispatchContext;
>>>> import org.ofbiz.service.ServiceUtil;
>>>> -
>>>> import org.w3c.dom.Comment;
>>>> import org.w3c.dom.Document;
>>>> import org.w3c.dom.Element;
>>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>>                        if (apacheLicenseText != null) {
>>>>                            fos.write(apacheLicenseText.getBytes());
>>>>                        }
>>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>>                    } finally {
>>>>                        fos.close();
>>>>                        // clear cache to see immediately the new labels and
>>>> 
>>>> 
>>> 


Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Mmm... but then how do you fix the bug in released branches?

Jacques

From: "Jacques Le Roux" <ja...@les7arts.com>
> Ha indeed, I have reverted R10.04 and R11.04. I will deprecate on trunk and R12.04
>
> Jacques
>
> From: "Scott Gray" <sc...@hotwaxmedia.com>
>> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. 
>> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old 
>> method.  Obviously deprecation shouldn't be back-ported.
>>
>> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>>
>> Regards
>> Scott
>>
>> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>>
>>> Author: jleroux
>>> Date: Tue May 15 19:11:13 2012
>>> New Revision: 1338836
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>>> Log:
>>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>>> ------------------------------------------------------------------------
>>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>>
>>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into 
>>> UtilXml.createOutputTransformer()
>>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>>> * Adds the xml:space attribute into the valueType complexType
>>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>>
>>> I got an issue when 1st trying to commit:
>>> Commit failed (details follow):
>>> While preparing
>>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>>> Inconsistent line ending style
>>>
>>> So I forced the EOLs to my locale platform value (Win XP)
>>> ------------------------------------------------------------------------
>>> 
>>>
>>> Modified:
>>>    ofbiz/branches/release12.04/   (props changed)
>>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>>
>>> Propchange: ofbiz/branches/release12.04/
>>> ------------------------------------------------------------------------------
>>>  Merged /ofbiz/trunk:r1338831
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>>> @@ -29,4 +29,5 @@ under the License.
>>>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>>> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>>> </catalog>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>>> @@ -42,6 +42,7 @@ under the License.
>>>         <xs:simpleContent>
>>>             <xs:extension base="xs:string">
>>>                 <xs:attribute ref="xml:lang"/>
>>> +                <xs:attribute ref="xml:space"/>
>>>             </xs:extension>
>>>         </xs:simpleContent>
>>>     </xs:complexType>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>>> @@ -158,20 +158,26 @@ public class UtilXml {
>>>
>>>     // ----- TrAX Methods ----------------- //
>>>
>>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>>> -     * XML document. This method is provided as an alternative to the
>>> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>> -     * will be omitted from the output
>>> -     * @param indent If <code>true</code>, the output will be indented
>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>> -     * the number of spaces to indent. Default is 4.
>>> +    /**
>>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative 
>>> to the deprecated
>>> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
>>> +     *
>>> +     * @param encoding
>>> +     *            Optional encoding, defaults to UTF-8
>>> +     * @param omitXmlDeclaration
>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>> +     * @param indent
>>> +     *            If <code>true</code>, the output will be indented
>>> +     * @param indentAmount
>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>> +     * @param keepSpace
>>> +     *            If <code>true</code> spaces are preserved, else striped
>>>      * @return A <code>Transformer</code> instance
>>>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>      * @throws TransformerConfigurationException
>>>      */
>>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>>> indentAmount) throws TransformerConfigurationException {
>>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>>> indentAmount, boolean keepSpace)
>>> +            throws TransformerConfigurationException {
>>>         StringBuilder sb = new StringBuilder();
>>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" 
>>> version=\"1.0\">\n");
>>> @@ -189,7 +195,11 @@ public class UtilXml {
>>>             sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>>             sb.append("\"");
>>>         }
>>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> +        if (keepSpace) {
>>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>>> +        } else {
>>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>>> +        }
>>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>>> @@ -212,21 +222,29 @@ public class UtilXml {
>>>         transformer.transform(source, result);
>>>     }
>>>
>>> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>>> -     * using JAXP TrAX.
>>> -     * @param node The <code>Node</code> to serialize
>>> -     * @param os The <code>OutputStream</code> to serialize to
>>> -     * @param encoding Optional encoding, defaults to UTF-8
>>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>>> -     * will be omitted from the output
>>> -     * @param indent If <code>true</code>, the output will be indented
>>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>>> -     * the number of spaces to indent. Default is 4.
>>> +    /**
>>> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>>> +     *
>>> +     * @param node
>>> +     *            The <code>Node</code> to serialize
>>> +     * @param os
>>> +     *            The <code>OutputStream</code> to serialize to
>>> +     * @param encoding
>>> +     *            Optional encoding, defaults to UTF-8
>>> +     * @param omitXmlDeclaration
>>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>>> +     * @param keepSpace
>>> +     *            If <code>true</code> spaces are preserved, else striped
>>> +     * @param indent
>>> +     *            If <code>true</code>, the output will be indented
>>> +     * @param indentAmount
>>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>>      * @throws TransformerException
>>>      */
>>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean 
>>> indent, int indentAmount) throws TransformerException {
>>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean 
>>> indent, int indentAmount,
>>> +            boolean keepSpace) throws TransformerException {
>>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>>         transformDomDocument(transformer, node, os);
>>>     }
>>>
>>> @@ -325,9 +343,9 @@ public class UtilXml {
>>>             return;
>>>         }
>>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>>> -        // charset = UTF-8, line width = 72
>>> +        // charset = UTF-8, line width = 72, strip spaces
>>>         try {
>>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>>         } catch (TransformerException e) {
>>>             // Wrapping this exception for backwards compatibility
>>>             throw new IOException(e.getMessage());
>>>
>>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>>> @@ -8,6 +8,7 @@
>>>     to you under the Apache License, Version 2.0 (the
>>>     "License"); you may not use this file except in compliance
>>>     with the License.  You may obtain a copy of the License at
>>> +
>>>     http://www.apache.org/licenses/LICENSE-2.0
>>>
>>>     Unless required by applicable law or agreed to in writing,
>>> @@ -17,13 +18,13 @@
>>>     specific language governing permissions and limitations
>>>     under the License.
>>> -->
>>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>>     <property key="AP">
>>>         <value xml:lang="de">Kreditoren</value>
>>>         <value xml:lang="en">AP</value>
>>>         <value xml:lang="es">Compras</value>
>>>         <value xml:lang="fr">Cpt. fourn.</value>
>>> -        <value xml:lang="hi_IN">लà¥?à¤-ा दà¥?य</value>
>>> +        <value xml:lang="hi-IN">लà¥?à¤-ा दà¥?य</value>
>>>         <value xml:lang="it">AP</value>
>>>         <value xml:lang="nl">Schulden</value>
>>>         <value xml:lang="pt_BR">Contas a pagar</value>
>>> @@ -127,6 +128,7 @@
>>>     <property key="CommonAbort">
>>>         <value xml:lang="en">Abort</value>
>>>         <value xml:lang="es">Cancelar</value>
>>> +        <value xml:lang="fr">Abandonner</value>
>>>         <value xml:lang="vi">Hủy</value>
>>>     </property>
>>>     <property key="CommonAccepted">
>>> @@ -413,6 +415,7 @@
>>>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>>         <value xml:lang="en">Address not found.</value>
>>>         <value xml:lang="es">Dirección no encontrada.</value>
>>> +        <value xml:lang="fr">Adresse inconnue</value>
>>>         <value xml:lang="vi">Không tìm thấy Ä'á» >>     </property>
>>>     <property key="CommonAddresses">
>>> @@ -2770,7 +2773,8 @@
>>>         <value xml:lang="zh_TW">é>»å­éfµä»¶</value>
>>>     </property>
>>>     <property key="CommonEmptyHeader">
>>> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>>> +        <!-- do not  remove this! -->
>>> +        <value xml:lang="en" xml:space="preserve"> </value>
>>>     </property>
>>>     <property key="CommonEnable">
>>>         <value xml:lang="en">Enable</value>
>>> @@ -11081,6 +11085,31 @@
>>>         <value xml:lang="zh">æo?æ.^æ-¥æoY</value>
>>>         <value xml:lang="zh_TW">æo?æ.^æ-¥</value>
>>>     </property>
>>> +    <property key="FormFieldTitle_expireButton">
>>> +        <value xml:lang="ar">Ù?Ù?اÙSØ© اÙ"صÙ"احÙSØ©</value>
>>> +        <value xml:lang="cs">Vypršet</value>
>>> +        <value xml:lang="de">Ablaufen</value>
>>> +        <value xml:lang="en">Expire</value>
>>> +        <value xml:lang="es">Expiración</value>
>>> +        <value xml:lang="fr">Invalider</value>
>>> +        <value xml:lang="hi-IN">निश्वासन</value>
>>> +        <value xml:lang="it">Scade</value>
>>> +        <value xml:lang="nl">Maak verlopen</value>
>>> +        <value xml:lang="pt">Expirar</value>
>>> +        <value xml:lang="pt-PT">Terminar</value>
>>> +        <value xml:lang="ro">Expira</value>
>>> +        <value xml:lang="ru">ÐYÑ?екÑ?аÑ,иÑ,ÑO</value>
>>> +        <value xml:lang="th">หมà¸"à¹?à¸,à¸.</value>
>>> +        <value xml:lang="vi">Hết hạn</value>
>>> +        <value xml:lang="zh">è¿?æoY</value>
>>> +        <value xml:lang="zh-CN">è¿?æoY</value>
>>> +        <value xml:lang="zh-TW">éZæoY</value>
>>> +    </property>
>>> +    <property key="FormFieldTitle_extDevicePurposeActionId">
>>> +        <value xml:lang="en">External Device Purpose Action Id</value>
>>> +        <value xml:lang="es">Código acción dispositivo externo</value>
>>> +        <value xml:lang="fr">Obj. de l'action</value>
>>> +    </property>
>>>     <property key="FormFieldTitle_externalDeviceId">
>>>         <value xml:lang="en">External Device Id</value>
>>>         <value xml:lang="es">Código dispositivo externo</value>
>>> @@ -11091,11 +11120,6 @@
>>>         <value xml:lang="es">Código tipo dispositivo externo</value>
>>>         <value xml:lang="fr">Type de Mat. Externe</value>
>>>     </property>
>>> -    <property key="FormFieldTitle_extDevicePurposeActionId">
>>> -        <value xml:lang="en">External Device Purpose Action Id</value>
>>> -        <value xml:lang="es">Código acción dispositivo externo</value>
>>> -        <value xml:lang="fr">Obj. de l'action</value>
>>> -    </property>
>>>     <property key="FormFieldTitle_fromDate">
>>>         <value xml:lang="ar">تارÙSØ® اÙ"بدء</value>
>>>         <value xml:lang="de">Von Datum</value>
>>>
>>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>>> ==============================================================================
>>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 
>>> 19:11:13 2012
>>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.base.util.UtilXml;
>>> import org.ofbiz.base.util.cache.UtilCache;
>>> -
>>> import org.ofbiz.service.DispatchContext;
>>> import org.ofbiz.service.ServiceUtil;
>>> -
>>> import org.w3c.dom.Comment;
>>> import org.w3c.dom.Document;
>>> import org.w3c.dom.Element;
>>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>>                         if (apacheLicenseText != null) {
>>>                             fos.write(apacheLicenseText.getBytes());
>>>                         }
>>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>>                     } finally {
>>>                         fos.close();
>>>                         // clear cache to see immediately the new labels and
>>>
>>>
>>
>> 

Re: svn commit: r1338836 - in /ofbiz/branches/release12.04: ./ framework/base/dtd/ framework/base/src/org/ofbiz/base/util/ framework/common/config/ framework/webtools/src/org/ofbiz/webtools/labelmanager/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Ha indeed, I have reverted R10.04 and R11.04. I will deprecate on trunk and R12.04

Jacques

From: "Scott Gray" <sc...@hotwaxmedia.com>
> You've changed the signature on the UtilXml methods, that should not be done and especially not be back-ported to the branches. 
> Even in the trunk the correct thing to do is to add a new method with the new signature and then (if needed) deprecate the old 
> method.  Obviously deprecation shouldn't be back-ported.
>
> There's nothing new in this comment Jacques, the general rule of thumb is never change a method signature unless it is private.
>
> Regards
> Scott
>
> On 16/05/2012, at 7:11 AM, jleroux@apache.org wrote:
>
>> Author: jleroux
>> Date: Tue May 15 19:11:13 2012
>> New Revision: 1338836
>>
>> URL: http://svn.apache.org/viewvc?rev=1338836&view=rev
>> Log:
>> "Applied fix from trunk for revision: 1338831" (conflict in CommonUiLabels.xml handled by hand)
>> ------------------------------------------------------------------------
>> r1338831 | jleroux | 2012-05-15 21:03:26 +0200 (mar., 15 mai 2012) | 14 lines
>>
>> Fixes https://issues.apache.org/jira/browse/OFBIZ-4652 "The Label Manager is wrongly overriding CommonEmptyHeader"
>> * Adds a keepSpace boolean to UtilXml.writeXmlDocument(), this allows to use xsl:preserve-space into 
>> UtilXml.createOutputTransformer()
>> * Uses it into SaveLabelsToXmlFile.saveLabelsToXmlFile()
>> * Adds some French labels into CommonUiLabels.xml using Labels Manager to test the new functionality
>> * Adds the xml:space attribute into the valueType complexType
>> * Adds the ofbiz-properties.xsd schema into the base-catalog.xml
>>
>> I got an issue when 1st trying to commit:
>> Commit failed (details follow):
>> While preparing
>> 'D:\workspace\ofbizClean\framework\common\config\CommonUiLabels.xml' for commit
>> Inconsistent line ending style
>>
>> So I forced the EOLs to my locale platform value (Win XP)
>> ------------------------------------------------------------------------
>> 
>>
>> Modified:
>>    ofbiz/branches/release12.04/   (props changed)
>>    ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>>    ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>>    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>>    ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>>    ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>>
>> Propchange: ofbiz/branches/release12.04/
>> ------------------------------------------------------------------------------
>>  Merged /ofbiz/trunk:r1338831
>>
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/base-catalog.xml Tue May 15 19:11:13 2012
>> @@ -29,4 +29,5 @@ under the License.
>>     <system systemId="http://ofbiz.apache.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
>>     <system systemId="http://ofbiz.apache.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
>> +    <system systemId="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd" uri="ofbiz-properties.xsd"/>
>> </catalog>
>>
>> Modified: ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd (original)
>> +++ ofbiz/branches/release12.04/framework/base/dtd/ofbiz-properties.xsd Tue May 15 19:11:13 2012
>> @@ -42,6 +42,7 @@ under the License.
>>         <xs:simpleContent>
>>             <xs:extension base="xs:string">
>>                 <xs:attribute ref="xml:lang"/>
>> +                <xs:attribute ref="xml:space"/>
>>             </xs:extension>
>>         </xs:simpleContent>
>>     </xs:complexType>
>>
>> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
>> +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Tue May 15 19:11:13 2012
>> @@ -158,20 +158,26 @@ public class UtilXml {
>>
>>     // ----- TrAX Methods ----------------- //
>>
>> -    /** Creates a JAXP TrAX Transformer suitable for pretty-printing an
>> -     * XML document. This method is provided as an alternative to the
>> -     * deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
>> -     * @param encoding Optional encoding, defaults to UTF-8
>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> -     * will be omitted from the output
>> -     * @param indent If <code>true</code>, the output will be indented
>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>> -     * the number of spaces to indent. Default is 4.
>> +    /**
>> +     * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative 
>> to the deprecated
>> +     * <code>org.apache.xml.serialize.OutputFormat</code> class.
>> +     *
>> +     * @param encoding
>> +     *            Optional encoding, defaults to UTF-8
>> +     * @param omitXmlDeclaration
>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>> +     * @param indent
>> +     *            If <code>true</code>, the output will be indented
>> +     * @param indentAmount
>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>> +     * @param keepSpace
>> +     *            If <code>true</code> spaces are preserved, else striped
>>      * @return A <code>Transformer</code> instance
>>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>      * @throws TransformerConfigurationException
>>      */
>> -    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>> indentAmount) throws TransformerConfigurationException {
>> +    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int 
>> indentAmount, boolean keepSpace)
>> +            throws TransformerConfigurationException {
>>         StringBuilder sb = new StringBuilder();
>>         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>>         sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" 
>> version=\"1.0\">\n");
>> @@ -189,7 +195,11 @@ public class UtilXml {
>>             sb.append(indentAmount <= 0 ? 4 : indentAmount);
>>             sb.append("\"");
>>         }
>> -        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> +        if (keepSpace) {
>> +            sb.append("/>\n<xsl:preserve-space elements=\"*\"/>\n");
>> +        } else {
>> +            sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
>> +        }
>>         sb.append("<xsl:template match=\"@*|node()\">\n");
>>         sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
>>         sb.append("</xsl:template>\n</xsl:stylesheet>\n");
>> @@ -212,21 +222,29 @@ public class UtilXml {
>>         transformer.transform(source, result);
>>     }
>>
>> -    /** Serializes a DOM <code>Node</code> to an <code>OutputStream</code>
>> -     * using JAXP TrAX.
>> -     * @param node The <code>Node</code> to serialize
>> -     * @param os The <code>OutputStream</code> to serialize to
>> -     * @param encoding Optional encoding, defaults to UTF-8
>> -     * @param omitXmlDeclaration If <code>true</code> the xml declaration
>> -     * will be omitted from the output
>> -     * @param indent If <code>true</code>, the output will be indented
>> -     * @param indentAmount If <code>indent</code> is <code>true</code>,
>> -     * the number of spaces to indent. Default is 4.
>> +    /**
>> +     * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
>> +     *
>> +     * @param node
>> +     *            The <code>Node</code> to serialize
>> +     * @param os
>> +     *            The <code>OutputStream</code> to serialize to
>> +     * @param encoding
>> +     *            Optional encoding, defaults to UTF-8
>> +     * @param omitXmlDeclaration
>> +     *            If <code>true</code> the xml declaration will be omitted from the output
>> +     * @param keepSpace
>> +     *            If <code>true</code> spaces are preserved, else striped
>> +     * @param indent
>> +     *            If <code>true</code>, the output will be indented
>> +     * @param indentAmount
>> +     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
>>      * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
>>      * @throws TransformerException
>>      */
>> -    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, 
>> int indentAmount) throws TransformerException {
>> -        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
>> +    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, 
>> int indentAmount,
>> +            boolean keepSpace) throws TransformerException {
>> +        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount, keepSpace);
>>         transformDomDocument(transformer, node, os);
>>     }
>>
>> @@ -325,9 +343,9 @@ public class UtilXml {
>>             return;
>>         }
>>         // OutputFormat defaults are: indent on, indent = 4, include XML declaration,
>> -        // charset = UTF-8, line width = 72
>> +        // charset = UTF-8, line width = 72, strip spaces
>>         try {
>> -            writeXmlDocument(node, os, "UTF-8", false, true, 4);
>> +            writeXmlDocument(node, os, "UTF-8", false, true, 4, false);
>>         } catch (TransformerException e) {
>>             // Wrapping this exception for backwards compatibility
>>             throw new IOException(e.getMessage());
>>
>> Modified: ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/config/CommonUiLabels.xml Tue May 15 19:11:13 2012
>> @@ -8,6 +8,7 @@
>>     to you under the Apache License, Version 2.0 (the
>>     "License"); you may not use this file except in compliance
>>     with the License.  You may obtain a copy of the License at
>> +
>>     http://www.apache.org/licenses/LICENSE-2.0
>>
>>     Unless required by applicable law or agreed to in writing,
>> @@ -17,13 +18,13 @@
>>     specific language governing permissions and limitations
>>     under the License.
>> -->
>> -<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
>>     <property key="AP">
>>         <value xml:lang="de">Kreditoren</value>
>>         <value xml:lang="en">AP</value>
>>         <value xml:lang="es">Compras</value>
>>         <value xml:lang="fr">Cpt. fourn.</value>
>> -        <value xml:lang="hi_IN">लà¥?à¤-ा दà¥?य</value>
>> +        <value xml:lang="hi-IN">लà¥?à¤-ा दà¥?य</value>
>>         <value xml:lang="it">AP</value>
>>         <value xml:lang="nl">Schulden</value>
>>         <value xml:lang="pt_BR">Contas a pagar</value>
>> @@ -127,6 +128,7 @@
>>     <property key="CommonAbort">
>>         <value xml:lang="en">Abort</value>
>>         <value xml:lang="es">Cancelar</value>
>> +        <value xml:lang="fr">Abandonner</value>
>>         <value xml:lang="vi">Hủy</value>
>>     </property>
>>     <property key="CommonAccepted">
>> @@ -413,6 +415,7 @@
>>         <value xml:lang="de">Die Adresse wurde nicht gefunden.</value>
>>         <value xml:lang="en">Address not found.</value>
>>         <value xml:lang="es">Dirección no encontrada.</value>
>> +        <value xml:lang="fr">Adresse inconnue</value>
>>         <value xml:lang="vi">Không tìm thấy Ä'á» >>     </property>
>>     <property key="CommonAddresses">
>> @@ -2770,7 +2773,8 @@
>>         <value xml:lang="zh_TW">é>»å­éfµä»¶</value>
>>     </property>
>>     <property key="CommonEmptyHeader">
>> -        <value xml:lang="en" xml:space="preserve"> </value><!-- do not  remove this! -->
>> +        <!-- do not  remove this! -->
>> +        <value xml:lang="en" xml:space="preserve"> </value>
>>     </property>
>>     <property key="CommonEnable">
>>         <value xml:lang="en">Enable</value>
>> @@ -11081,6 +11085,31 @@
>>         <value xml:lang="zh">æo?æ.^æ-¥æoY</value>
>>         <value xml:lang="zh_TW">æo?æ.^æ-¥</value>
>>     </property>
>> +    <property key="FormFieldTitle_expireButton">
>> +        <value xml:lang="ar">Ù?Ù?اÙSØ© اÙ"صÙ"احÙSØ©</value>
>> +        <value xml:lang="cs">Vypršet</value>
>> +        <value xml:lang="de">Ablaufen</value>
>> +        <value xml:lang="en">Expire</value>
>> +        <value xml:lang="es">Expiración</value>
>> +        <value xml:lang="fr">Invalider</value>
>> +        <value xml:lang="hi-IN">निश्वासन</value>
>> +        <value xml:lang="it">Scade</value>
>> +        <value xml:lang="nl">Maak verlopen</value>
>> +        <value xml:lang="pt">Expirar</value>
>> +        <value xml:lang="pt-PT">Terminar</value>
>> +        <value xml:lang="ro">Expira</value>
>> +        <value xml:lang="ru">ÐYÑ?екÑ?аÑ,иÑ,ÑO</value>
>> +        <value xml:lang="th">หมà¸"à¹?à¸,à¸.</value>
>> +        <value xml:lang="vi">Hết hạn</value>
>> +        <value xml:lang="zh">è¿?æoY</value>
>> +        <value xml:lang="zh-CN">è¿?æoY</value>
>> +        <value xml:lang="zh-TW">éZæoY</value>
>> +    </property>
>> +    <property key="FormFieldTitle_extDevicePurposeActionId">
>> +        <value xml:lang="en">External Device Purpose Action Id</value>
>> +        <value xml:lang="es">Código acción dispositivo externo</value>
>> +        <value xml:lang="fr">Obj. de l'action</value>
>> +    </property>
>>     <property key="FormFieldTitle_externalDeviceId">
>>         <value xml:lang="en">External Device Id</value>
>>         <value xml:lang="es">Código dispositivo externo</value>
>> @@ -11091,11 +11120,6 @@
>>         <value xml:lang="es">Código tipo dispositivo externo</value>
>>         <value xml:lang="fr">Type de Mat. Externe</value>
>>     </property>
>> -    <property key="FormFieldTitle_extDevicePurposeActionId">
>> -        <value xml:lang="en">External Device Purpose Action Id</value>
>> -        <value xml:lang="es">Código acción dispositivo externo</value>
>> -        <value xml:lang="fr">Obj. de l'action</value>
>> -    </property>
>>     <property key="FormFieldTitle_fromDate">
>>         <value xml:lang="ar">تارÙSØ® اÙ"بدء</value>
>>         <value xml:lang="de">Von Datum</value>
>>
>> Modified: ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1338836&r1=1338835&r2=1338836&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
>> +++ ofbiz/branches/release12.04/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Tue May 15 
>> 19:11:13 2012
>> @@ -34,10 +34,8 @@ import org.ofbiz.base.util.UtilPropertie
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.UtilXml;
>> import org.ofbiz.base.util.cache.UtilCache;
>> -
>> import org.ofbiz.service.DispatchContext;
>> import org.ofbiz.service.ServiceUtil;
>> -
>> import org.w3c.dom.Comment;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> @@ -151,7 +149,7 @@ public class SaveLabelsToXmlFile {
>>                         if (apacheLicenseText != null) {
>>                             fos.write(apacheLicenseText.getBytes());
>>                         }
>> -                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4);
>> +                        UtilXml.writeXmlDocument(resourceElem, fos, "UTF-8", !(apacheLicenseText == null), true, 4, true);
>>                     } finally {
>>                         fos.close();
>>                         // clear cache to see immediately the new labels and
>>
>>
>
>