You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by je...@apache.org on 2003/03/12 13:06:55 UTC
cvs commit: avalon/src/java/org/apache/avalon/framework/configuration ConfigurationUtil.java
jefft 2003/03/12 04:06:55
Modified: src/java/org/apache/avalon/framework/configuration
ConfigurationUtil.java
Log:
Added a static toString(Configuration) method. Useful in println() statements
when debugging
Revision Changes Path
1.12 +28 -1 avalon/src/java/org/apache/avalon/framework/configuration/ConfigurationUtil.java
Index: ConfigurationUtil.java
===================================================================
RCS file: /home/cvs/avalon/src/java/org/apache/avalon/framework/configuration/ConfigurationUtil.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ConfigurationUtil.java 11 Feb 2003 15:58:38 -0000 1.11
+++ ConfigurationUtil.java 12 Mar 2003 12:06:54 -0000 1.12
@@ -64,6 +64,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import org.xml.sax.SAXException;
/**
* This class has a bunch of utility methods to work
@@ -71,6 +72,7 @@
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version CVS $Revision$ $Date$
+ * @since 4.1.4
*/
public class ConfigurationUtil
{
@@ -100,6 +102,31 @@
catch( final ParserConfigurationException pce )
{
throw new IllegalStateException( pce.toString() );
+ }
+ }
+
+ /**
+ * Serialize the configuration object to a String. If an exception
+ * occurs, the exception message will be returned instead. This method is
+ * intended to aid debugging; {@link
+ * DefaultConfigurationSerializer#serialize(Configuration)} lets the caller
+ * handle exceptions.
+ *
+ * @param configuration Configuration instance to serialize
+ * @return a non-null String representing the <code>Configuration</code>,
+ * or an error message.
+ * @since 12 March, 2003
+ */
+ public static String toString( final Configuration configuration )
+ {
+ DefaultConfigurationSerializer ser = new DefaultConfigurationSerializer();
+ try
+ {
+ return ser.serialize( configuration );
+ }
+ catch (Exception e )
+ {
+ return e.getMessage();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org
Re: cvs commit: avalon/src/java/org/apache/avalon/framework/configuration ConfigurationUtil.java
Posted by Peter Donald <pe...@realityforge.org>.
On Wed, 12 Mar 2003 23:06, jefft@apache.org wrote:
> jefft 2003/03/12 04:06:55
>
> Modified: src/java/org/apache/avalon/framework/configuration
> ConfigurationUtil.java
> Log:
> Added a static toString(Configuration) method. Useful in println()
> statements when debugging
WIll this make ConfigurationUtil dependent on a trax provider being present?
--
Cheers,
Peter Donald
*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof." *
* - John Kenneth Galbraith *
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org