commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@t-online.de>
Subject Re: svn commit: r392787 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/XMLConfiguration.java src/test/org/apache/commons/configuration/TestXMLConfiguration.java xdocs/changes.xml
Date Mon, 10 Apr 2006 19:25:13 GMT
Rahul Akolkar wrote:

>On 4/9/06, oheger@apache.org <oheger@apache.org> wrote:
>  
>
>>Author: oheger
>>Date: Sun Apr  9 10:30:37 2006
>>New Revision: 392787
>>
>>URL: http://svn.apache.org/viewcvs?rev=392787&view=rev
>>Log:
>>XMLConfiguration now keeps the public and system ID of the DOCTYPE declaration; fix
for issue 39227
>>
>>Modified:
>>   jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
>>    
>>
><snip/>
>  
>
>>    /**
>>+     * Creates and initializes the transformer used for save operations. This
>>+     * base implementation initializes all of the default settings like
>>+     * indention mode and the DOCTYPE. Derived classes may overload this method
>>+     * if they have specific needs.
>>+     *
>>+     * @return the transformer to use for a save operation
>>+     * @throws TransformerException if an error occurs
>>+     * @since 1.3
>>+     */
>>+    protected Transformer createTransformer() throws TransformerException
>>+    {
>>+        Transformer transformer = TransformerFactory.newInstance()
>>+                .newTransformer();
>>+
>>    
>>
><snap/>
>
>Maybe catch TransformerFactoryConfigurationError here? (if only to log
>and/or rethrow as some TransformerException, since its unlikely that
>client code will watch out for it)
>
>-Rahul
>  
>
You mean to avoid that an application dies with an error? Good point.

But then I would rather catch it in the calling save() method. This is
probably safer if somebody overrides the createTransformer() method.

Thanks for the spot!
Oliver

>
>  
>
>>+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
>>+        if (getEncoding() != null)
>>+        {
>>+            transformer.setOutputProperty(OutputKeys.ENCODING, getEncoding());
>>+        }
>>+        if (getPublicID() != null)
>>+        {
>>+            transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
>>+                    getPublicID());
>>+        }
>>+        if (getSystemID() != null)
>>+        {
>>+            transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
>>+                    getSystemID());
>>+        }
>>+
>>+        return transformer;
>>+    }
>>    
>>
><snip/>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message