commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102402 [11/20] - in /commons/sandbox/digester3/trunk/src: main/java/org/apache/commons/digester3/ main/java/org/apache/commons/digester3/annotations/ main/java/org/apache/commons/digester3/annotations/handlers/ main/java/org/apache/common...
Date Thu, 12 May 2011 18:03:33 GMT
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/MultiVariableExpander.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/MultiVariableExpander.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/MultiVariableExpander.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/MultiVariableExpander.java
Thu May 12 18:03:26 2011
@@ -22,95 +22,96 @@ import java.util.Map;
 import java.util.ArrayList;
 
 /**
- * <p>Expands variable references from multiple sources.</p>
- *
+ * <p>
+ * Expands variable references from multiple sources.
+ * </p>
+ * 
  * @since 1.6
  */
 
-public class MultiVariableExpander implements VariableExpander {
+public class MultiVariableExpander
+    implements VariableExpander
+{
     private int nEntries = 0;
-    private ArrayList<String> markers = new ArrayList<String>(2);
-    private ArrayList<Map<String, Object>> sources = new ArrayList<Map<String,
Object>>(2);
-    
-    public MultiVariableExpander() {
+
+    private ArrayList<String> markers = new ArrayList<String>( 2 );
+
+    private ArrayList<Map<String, Object>> sources = new ArrayList<Map<String,
Object>>( 2 );
+
+    public MultiVariableExpander()
+    {
     }
-    
-    public void addSource(String marker, Map<String, Object> source) {
+
+    public void addSource( String marker, Map<String, Object> source )
+    {
         ++nEntries;
-        markers.add(marker);
-        sources.add(source);
+        markers.add( marker );
+        sources.add( source );
     }
 
-    /*    
-     * Expands any variable declarations using any of the known
-     * variable marker strings.
-     * 
-     * @throws IllegalArgumentException if the input param references
-     * a variable which is not known to the specified source.
+    /*
+     * Expands any variable declarations using any of the known variable marker strings.
+     * @throws IllegalArgumentException if the input param references a variable which is
not known to the specified
+     * source.
      */
-    public String expand(String param) {
-        for(int i=0; i<nEntries; ++i) {
-            param = expand(
-                param, 
-                markers.get(i), 
-                sources.get(i));
+    public String expand( String param )
+    {
+        for ( int i = 0; i < nEntries; ++i )
+        {
+            param = expand( param, markers.get( i ), sources.get( i ) );
         }
         return param;
     }
-    
+
     /**
-     * Replace any occurrences within the string of the form
-     * "marker{key}" with the value from source[key].
+     * Replace any occurrences within the string of the form "marker{key}" with the value
from source[key].
      * <p>
-     * Commonly, the variable marker is "$", in which case variables
-     * are indicated by ${key} in the string.
+     * Commonly, the variable marker is "$", in which case variables are indicated by ${key}
in the string.
      * <p>
      * Returns the string after performing all substitutions.
      * <p>
-     * If no substitutions were made, the input string object is
-     * returned (not a copy).
-     *
-     * @throws IllegalArgumentException if the input param references
-     * a variable which is not known to the specified source.
+     * If no substitutions were made, the input string object is returned (not a copy).
+     * 
+     * @throws IllegalArgumentException if the input param references a variable which is
not known to the specified
+     *             source.
      */
-    public String expand(String str, String marker, Map<String, Object> source) {
+    public String expand( String str, String marker, Map<String, Object> source )
+    {
         String startMark = marker + "{";
         int markLen = startMark.length();
-        
+
         int index = 0;
-        for(;;)
+        for ( ;; )
         {
-            index = str.indexOf(startMark, index);
-            if (index == -1)
+            index = str.indexOf( startMark, index );
+            if ( index == -1 )
             {
                 return str;
             }
-            
+
             int startIndex = index + markLen;
-            if (startIndex > str.length())
+            if ( startIndex > str.length() )
             {
-                throw new IllegalArgumentException(
-                    "var expression starts at end of string");
+                throw new IllegalArgumentException( "var expression starts at end of string"
);
             }
-            
-            int endIndex = str.indexOf("}", index + markLen);
-            if (endIndex == -1)
+
+            int endIndex = str.indexOf( "}", index + markLen );
+            if ( endIndex == -1 )
             {
-                throw new IllegalArgumentException(
-                    "var expression starts but does not end");
+                throw new IllegalArgumentException( "var expression starts but does not end"
);
             }
-            
-            String key = str.substring(index+markLen, endIndex);
-            Object value =  source.get(key);
-            if (value == null) {
-                throw new IllegalArgumentException(
-                    "parameter [" + key + "] is not defined.");
+
+            String key = str.substring( index + markLen, endIndex );
+            Object value = source.get( key );
+            if ( value == null )
+            {
+                throw new IllegalArgumentException( "parameter [" + key + "] is not defined."
);
             }
             String varValue = value.toString();
-            
-            str = str.substring(0, index) + varValue + str.substring(endIndex+1);
+
+            str = str.substring( 0, index ) + varValue + str.substring( endIndex + 1 );
             index += varValue.length();
         }
     }
-        
+
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableAttributes.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableAttributes.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableAttributes.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableAttributes.java
Thu May 12 18:03:26 2011
@@ -16,125 +16,146 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3.substitution;
 
 import org.xml.sax.Attributes;
 
 import java.util.ArrayList;
 
-
 /**
- * <p>Wrapper for an org.xml.sax.Attributes object which expands any 
- * "variables" referenced in the attribute value via ${foo} or similar. 
- * This is only done when something actually asks for the attribute value, 
- * thereby imposing no performance penalty if the attribute is not used.</p>
- *
+ * <p>
+ * Wrapper for an org.xml.sax.Attributes object which expands any "variables" referenced
in the attribute value via
+ * ${foo} or similar. This is only done when something actually asks for the attribute value,
thereby imposing no
+ * performance penalty if the attribute is not used.
+ * </p>
+ * 
  * @since 1.6
  */
 
-public class VariableAttributes implements Attributes {
+public class VariableAttributes
+    implements Attributes
+{
 
     // list of mapped attributes.
-    private ArrayList<String> values = new ArrayList<String>(10);
+    private ArrayList<String> values = new ArrayList<String>( 10 );
 
     private Attributes attrs;
+
     private VariableExpander expander;
-    
+
     // ------------------- Public Methods
-    
+
     /**
      * Specify which attributes class this object is a proxy for.
      */
-    public void init(Attributes attrs, VariableExpander expander) {
+    public void init( Attributes attrs, VariableExpander expander )
+    {
         this.attrs = attrs;
         this.expander = expander;
 
-        // I hope this doesn't release the memory for this array; for 
+        // I hope this doesn't release the memory for this array; for
         // efficiency, this should just mark the array as being size 0.
-        values.clear(); 
+        values.clear();
     }
 
-    public String getValue(int index) {
-        if (index >= values.size()) {
+    public String getValue( int index )
+    {
+        if ( index >= values.size() )
+        {
             // Expand the values array with null elements, so the later
             // call to set(index, s) works ok.
             //
             // Unfortunately, there is no easy way to set the size of
             // an arraylist; we must repeatedly add null elements to it..
-            values.ensureCapacity(index+1);
-            for(int i = values.size(); i<= index; ++i) {
-                values.add(null);
+            values.ensureCapacity( index + 1 );
+            for ( int i = values.size(); i <= index; ++i )
+            {
+                values.add( null );
             }
         }
-        
-        String s = values.get(index);
-        
-        if (s == null) {
+
+        String s = values.get( index );
+
+        if ( s == null )
+        {
             // we have never been asked for this value before.
             // get the real attribute value and perform substitution
             // on it.
-            s = attrs.getValue(index);
-            if (s != null) {
-                s = expander.expand(s);
-                values.set(index, s);
+            s = attrs.getValue( index );
+            if ( s != null )
+            {
+                s = expander.expand( s );
+                values.set( index, s );
             }
         }
-        
+
         return s;
     }
-    
-    public String getValue(String qname) {
-        int index = attrs.getIndex(qname);
-        if (index == -1) {
+
+    public String getValue( String qname )
+    {
+        int index = attrs.getIndex( qname );
+        if ( index == -1 )
+        {
             return null;
         }
-        return getValue(index);
+        return getValue( index );
     }
-    
-    public String getValue(String uri, String localname) {
-        int index = attrs.getIndex(uri, localname);
-        if (index == -1) {
+
+    public String getValue( String uri, String localname )
+    {
+        int index = attrs.getIndex( uri, localname );
+        if ( index == -1 )
+        {
             return null;
         }
-        return getValue(index);
+        return getValue( index );
     }
-    
+
     // plain proxy methods follow : nothing interesting :-)
-    public int getIndex(String qname) {
-        return attrs.getIndex(qname); 
+    public int getIndex( String qname )
+    {
+        return attrs.getIndex( qname );
     }
-    
-    public int getIndex(String uri, String localpart) {
-        return attrs.getIndex(uri, localpart); 
+
+    public int getIndex( String uri, String localpart )
+    {
+        return attrs.getIndex( uri, localpart );
     }
-    
-    public int getLength() {
+
+    public int getLength()
+    {
         return attrs.getLength();
     }
-    
-    public String getLocalName(int index) {
-        return attrs.getLocalName(index);
+
+    public String getLocalName( int index )
+    {
+        return attrs.getLocalName( index );
     }
-    
-    public String getQName(int index) {
-        return attrs.getQName(index);
+
+    public String getQName( int index )
+    {
+        return attrs.getQName( index );
     }
-    
-    public String getType(int index) {
-        return attrs.getType(index);
+
+    public String getType( int index )
+    {
+        return attrs.getType( index );
     }
 
-    public String getType(String qname) {
-        return attrs.getType(qname);
+    public String getType( String qname )
+    {
+        return attrs.getType( qname );
     }
-    
-    public String getType(String uri, String localname) {
-        return attrs.getType(uri, localname);
+
+    public String getType( String uri, String localname )
+    {
+        return attrs.getType( uri, localname );
     }
-    
-    public String getURI(int index) {
-        return attrs.getURI(index);
+
+    public String getURI( int index )
+    {
+        return attrs.getURI( index );
     }
- 
+
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableExpander.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableExpander.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableExpander.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableExpander.java
Thu May 12 18:03:26 2011
@@ -16,23 +16,22 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3.substitution;
 
 /**
- * <p>An Interface describing a class capable of expanding strings which
- * may contain variable references. The exact syntax of the "reference",
- * and the mechanism for determining the corresponding value to be used
- * is up to the concrete implementation.</p>
- *
+ * <p>
+ * An Interface describing a class capable of expanding strings which may contain variable
references. The exact syntax
+ * of the "reference", and the mechanism for determining the corresponding value to be used
is up to the concrete
+ * implementation.
+ * </p>
+ * 
  * @since 1.6
  */
-public interface VariableExpander {
+public interface VariableExpander
+{
     /**
-     * Return the input string with any variables replaced by their
-     * corresponding value. If there are no variables in the string,
-     * then the input parameter is returned unaltered.
+     * Return the input string with any variables replaced by their corresponding value.
If there are no variables in
+     * the string, then the input parameter is returned unaltered.
      */
-    public String expand(String param);
+    public String expand( String param );
 }
-

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableSubstitutor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableSubstitutor.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableSubstitutor.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/VariableSubstitutor.java
Thu May 12 18:03:26 2011
@@ -23,85 +23,86 @@ import org.apache.commons.digester3.Subs
 import org.xml.sax.Attributes;
 
 /**
- * Substitutor implementation that support variable replacement
- * for both attributes and body text.
- * The actual expansion of variables into text is delegated to {@link VariableExpander}
- * implementations.
- * Supports setting an expander just for body text or just for attributes.
- * Also supported is setting no expanders for body text and for attributes. 
- *
+ * Substitutor implementation that support variable replacement for both attributes and body
text. The actual expansion
+ * of variables into text is delegated to {@link VariableExpander} implementations. Supports
setting an expander just
+ * for body text or just for attributes. Also supported is setting no expanders for body
text and for attributes.
+ * 
  * @since 1.6
  */
-public class VariableSubstitutor extends Substitutor {
+public class VariableSubstitutor
+    extends Substitutor
+{
 
-    /** 
-     * The expander to be used to expand variables in the attributes.
-     * Null when no expansion should be performed.
+    /**
+     * The expander to be used to expand variables in the attributes. Null when no expansion
should be performed.
      */
     private VariableExpander attributesExpander;
-    
-    /** 
-     * Attributes implementation that (lazily) performs variable substitution.
-     * Will be lazily created when needed then reused.
+
+    /**
+     * Attributes implementation that (lazily) performs variable substitution. Will be lazily
created when needed then
+     * reused.
      */
     private VariableAttributes variableAttributes;
-    
-    /** 
-     * The expander to be used to expand variables in the body text.
-     * Null when no expansion should be performed.
+
+    /**
+     * The expander to be used to expand variables in the body text. Null when no expansion
should be performed.
      */
     private VariableExpander bodyTextExpander;
-    
+
     /**
-     * Constructs a Substitutor which uses the same VariableExpander for both
-     * body text and attibutes.
-     * @param expander VariableExpander implementation, 
-     * null if no substitutions are to be performed
-     */
-    public VariableSubstitutor(VariableExpander expander) {
-        this(expander, expander);
+     * Constructs a Substitutor which uses the same VariableExpander for both body text and
attibutes.
+     * 
+     * @param expander VariableExpander implementation, null if no substitutions are to be
performed
+     */
+    public VariableSubstitutor( VariableExpander expander )
+    {
+        this( expander, expander );
     }
-    
+
     /**
      * Constructs a Substitutor.
-     * @param attributesExpander VariableExpander implementation to be used for attributes,

-     * null if no attribute substitutions are to be performed
-     * @param bodyTextExpander VariableExpander implementation to be used for bodyTextExpander,

-     * null if no attribute substitutions are to be performed     
+     * 
+     * @param attributesExpander VariableExpander implementation to be used for attributes,
null if no attribute
+     *            substitutions are to be performed
+     * @param bodyTextExpander VariableExpander implementation to be used for bodyTextExpander,
null if no attribute
+     *            substitutions are to be performed
      */
-    public VariableSubstitutor(VariableExpander attributesExpander, VariableExpander bodyTextExpander)
{
+    public VariableSubstitutor( VariableExpander attributesExpander, VariableExpander bodyTextExpander
)
+    {
         this.attributesExpander = attributesExpander;
         this.bodyTextExpander = bodyTextExpander;
         variableAttributes = new VariableAttributes();
-    }    
+    }
 
     /**
-     * Substitutes the attributes (before they are passed to the 
-     * <code>Rule</code> implementations's)
+     * Substitutes the attributes (before they are passed to the <code>Rule</code>
implementations's)
      */
     @Override
-    public Attributes substitute(Attributes attributes) {
+    public Attributes substitute( Attributes attributes )
+    {
         Attributes results = attributes;
-        if (attributesExpander != null) {
-            variableAttributes.init(attributes, attributesExpander);
+        if ( attributesExpander != null )
+        {
+            variableAttributes.init( attributes, attributesExpander );
             results = variableAttributes;
         }
         return results;
     }
-    
+
     /**
-     * Substitutes for the body text.
-     * This method may substitute values into the body text of the
-     * elements that Digester parses.
-     *
+     * Substitutes for the body text. This method may substitute values into the body text
of the elements that Digester
+     * parses.
+     * 
      * @param bodyText the body text (as passed to <code>Digester</code>)
      * @return the body text to be passed to the <code>Rule</code> implementations
      */
     @Override
-    public String substitute(String bodyText) {
+    public String substitute( String bodyText )
+    {
         String result = bodyText;
-        if (bodyTextExpander != null) {
-            result = bodyTextExpander.expand(bodyText);
+        if ( bodyTextExpander != null )
+        {
+            result = bodyTextExpander.expand( bodyText );
         }
         return result;
     }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/package-info.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/package-info.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/substitution/package-info.java
Thu May 12 18:03:26 2011
@@ -21,3 +21,4 @@
  * element body text before the data is processed by any Rule objects.
  */
 package org.apache.commons.digester3.substitution;
+

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/CircularIncludeException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/CircularIncludeException.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/CircularIncludeException.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/CircularIncludeException.java
Thu May 12 18:03:26 2011
@@ -16,27 +16,26 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3.xmlrules;
 
-
 /**
- * Thrown when parsing XML into Digester rules, if a circular inclusion occurred
- * in the xml digester rules files.
- *
+ * Thrown when parsing XML into Digester rules, if a circular inclusion occurred in the xml
digester rules files.
+ * 
  * @since 1.2
  */
 
-public class CircularIncludeException extends XmlLoadException {
+public class CircularIncludeException
+    extends XmlLoadException
+{
 
     private static final long serialVersionUID = 1L;
 
     /**
-     * @param fileName the name of the XML file suspected of causing the
-     * circular inclusion
+     * @param fileName the name of the XML file suspected of causing the circular inclusion
      */
-    public CircularIncludeException(String fileName) {
-        super("Circular file inclusion detected for file: " + fileName);
+    public CircularIncludeException( String fileName )
+    {
+        super( "Circular file inclusion detected for file: " + fileName );
     }
 
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoader.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoader.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoader.java
Thu May 12 18:03:26 2011
@@ -16,10 +16,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3.xmlrules;
 
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
@@ -31,222 +29,218 @@ import org.apache.commons.digester3.Rule
 import org.xml.sax.SAXException;
 import org.xml.sax.InputSource;
 
-
 /**
- * This class manages the creation of Digester instances from XML digester
- * rules files.
- *
+ * This class manages the creation of Digester instances from XML digester rules files.
+ * 
  * @since 1.2
  */
 
-public class DigesterLoader {
+public class DigesterLoader
+{
 
     /**
      * Creates a new digester and initializes it from the specified InputSource
+     * 
      * @param rulesSource load the xml rules from this InputSource
      * @return a new Digester initialized with the rules
      */
-    public static Digester createDigester(InputSource rulesSource) {
-        RuleSet ruleSet = new FromXmlRuleSet(rulesSource);
+    public static Digester createDigester( InputSource rulesSource )
+    {
+        RuleSet ruleSet = new FromXmlRuleSet( rulesSource );
         Digester digester = new Digester();
-        digester.addRuleSet(ruleSet);
+        digester.addRuleSet( ruleSet );
         return digester;
     }
 
     /**
-     * Creates a new digester and initializes it from the specified InputSource.
-     * This constructor allows the digester to be used to load the rules to be specified.
-     * This allows properties to be configured on the Digester instance before it is used.
-     *
+     * Creates a new digester and initializes it from the specified InputSource. This constructor
allows the digester to
+     * be used to load the rules to be specified. This allows properties to be configured
on the Digester instance
+     * before it is used.
+     * 
      * @param rulesSource load the xml rules from this InputSource
      * @param rulesDigester digester to load the specified XML file.
      * @return a new Digester initialized with the rules
      */
-    public static Digester createDigester(InputSource rulesSource, Digester rulesDigester)
{
-        RuleSet ruleSet = new FromXmlRuleSet(rulesSource, rulesDigester);
+    public static Digester createDigester( InputSource rulesSource, Digester rulesDigester
)
+    {
+        RuleSet ruleSet = new FromXmlRuleSet( rulesSource, rulesDigester );
         Digester digester = new Digester();
-        digester.addRuleSet(ruleSet);
+        digester.addRuleSet( ruleSet );
         return digester;
     }
 
     /**
      * Creates a new digester and initializes it from the specified XML file
+     * 
      * @param rulesXml URL to the XML file defining the digester rules
      * @return a new Digester initialized with the rules
      */
-    public static Digester createDigester(URL rulesXml) {
-        RuleSet ruleSet = new FromXmlRuleSet(rulesXml);
+    public static Digester createDigester( URL rulesXml )
+    {
+        RuleSet ruleSet = new FromXmlRuleSet( rulesXml );
         Digester digester = new Digester();
-        digester.addRuleSet(ruleSet);
+        digester.addRuleSet( ruleSet );
         return digester;
     }
 
     /**
-     * Creates a new digester and initializes it from the specified XML file.
-     * This constructor allows specifing a rulesDigester to do the XML file
-     * loading; thus no matter the XML files is packed into a jar, a war, or a
-     * ear, the rulesDigester can always find the XML files with properly set
-     * ClassLoader.
-     *
+     * Creates a new digester and initializes it from the specified XML file. This constructor
allows specifing a
+     * rulesDigester to do the XML file loading; thus no matter the XML files is packed into
a jar, a war, or a ear, the
+     * rulesDigester can always find the XML files with properly set ClassLoader.
+     * 
      * @param rulesXml URL to the XML file defining the digester rules
      * @param rulesDigester digester to load the specified XML file.
      * @return a new Digester initialized with the rules
      */
-    public static Digester createDigester(URL rulesXml, Digester rulesDigester) {
-        RuleSet ruleSet = new FromXmlRuleSet(rulesXml, rulesDigester);
+    public static Digester createDigester( URL rulesXml, Digester rulesDigester )
+    {
+        RuleSet ruleSet = new FromXmlRuleSet( rulesXml, rulesDigester );
         Digester digester = new Digester();
-        digester.addRuleSet(ruleSet);
+        digester.addRuleSet( ruleSet );
         return digester;
     }
 
     /**
-     * Given the digester rules XML file, a class loader, and an XML input file,
-     * this method parses the input file into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an XML input file, this method
parses the input file into
+     * Java objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param fileURL URL to the XML file to parse into Java objects
-     * @return an Object which is the root of the network of Java objects
-     * created by digesting fileURL
+     * @return an Object which is the root of the network of Java objects created by digesting
fileURL
      */
-    public static Object load(URL digesterRules, ClassLoader classLoader,
-                              URL fileURL) throws IOException, SAXException, DigesterLoadingException
{
-        return load(digesterRules, classLoader, fileURL.openStream());
+    public static Object load( URL digesterRules, ClassLoader classLoader, URL fileURL )
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        return load( digesterRules, classLoader, fileURL.openStream() );
     }
 
     /**
-     * Given the digester rules XML file, a class loader, and an input stream,
-     * this method parses the input into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an input stream, this method
parses the input into Java
+     * objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param input InputStream over the XML file to parse into Java objects
-     * @return an Object which is the root of the network of Java objects
-     * created by digesting fileURL
+     * @return an Object which is the root of the network of Java objects created by digesting
fileURL
      */
-    public static Object load(URL digesterRules, ClassLoader classLoader,
-                              InputStream input) throws IOException, SAXException, DigesterLoadingException
{
-        Digester digester = createDigester(digesterRules);
-        digester.setClassLoader(classLoader);
-        try {
-            return digester.parse(input);
-        } catch (XmlLoadException ex) {
+    public static Object load( URL digesterRules, ClassLoader classLoader, InputStream input
)
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        Digester digester = createDigester( digesterRules );
+        digester.setClassLoader( classLoader );
+        try
+        {
+            return digester.parse( input );
+        }
+        catch ( XmlLoadException ex )
+        {
             // This is a runtime exception that can be thrown by
             // FromXmlRuleSet#addRuleInstances, which is called by the Digester
             // before it parses the file.
-            throw new DigesterLoadingException(ex.getMessage(), ex);
+            throw new DigesterLoadingException( ex.getMessage(), ex );
         }
     }
-    
+
     /**
-     * Given the digester rules XML file, a class loader, and an input stream,
-     * this method parses the input into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an input stream, this method
parses the input into Java
+     * objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param reader Reader over the XML file to parse into Java objects
-     * @return an Object which is the root of the network of Java objects
-     * created by digesting fileURL
+     * @return an Object which is the root of the network of Java objects created by digesting
fileURL
      */
-    public static Object load(
-                                URL digesterRules, 
-                                ClassLoader classLoader,
-                                Reader reader) 
-                                    throws 
-                                        IOException, 
-                                        SAXException, 
-                                        DigesterLoadingException {
-        Digester digester = createDigester(digesterRules);
-        digester.setClassLoader(classLoader);
-        try {
-            return digester.parse(reader);
-        } catch (XmlLoadException ex) {
+    public static Object load( URL digesterRules, ClassLoader classLoader, Reader reader
)
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        Digester digester = createDigester( digesterRules );
+        digester.setClassLoader( classLoader );
+        try
+        {
+            return digester.parse( reader );
+        }
+        catch ( XmlLoadException ex )
+        {
             // This is a runtime exception that can be thrown by
             // FromXmlRuleSet#addRuleInstances, which is called by the Digester
             // before it parses the file.
-            throw new DigesterLoadingException(ex.getMessage(), ex);
+            throw new DigesterLoadingException( ex.getMessage(), ex );
         }
     }
 
-
     /**
-     * Given the digester rules XML file, a class loader, and an XML input file,
-     * this method parses the input file into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an XML input file, this method
parses the input file into
+     * Java objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param fileURL URL to the XML file to parse into Java objects
-     * @param rootObject an Object to push onto the digester's stack, prior
-     * to parsing the input
-     * @return an Object which is the root of the network of Java objects.
-     * Usually, this will be the same object as rootObject
-     * created by digesting fileURL
-     */
-    public static Object load(URL digesterRules, ClassLoader classLoader,
-                              URL fileURL, Object rootObject) throws IOException, SAXException,
-            DigesterLoadingException {
-        return load(digesterRules, classLoader, fileURL.openStream(), rootObject);
+     * @param rootObject an Object to push onto the digester's stack, prior to parsing the
input
+     * @return an Object which is the root of the network of Java objects. Usually, this
will be the same object as
+     *         rootObject created by digesting fileURL
+     */
+    public static Object load( URL digesterRules, ClassLoader classLoader, URL fileURL, Object
rootObject )
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        return load( digesterRules, classLoader, fileURL.openStream(), rootObject );
     }
 
     /**
-     * Given the digester rules XML file, a class loader, and an input stream,
-     * this method parses the input into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an input stream, this method
parses the input into Java
+     * objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param input InputStream over the XML file to parse into Java objects
-     * @param rootObject an Object to push onto the digester's stack, prior
-     * to parsing the input
-     * @return an Object which is the root of the network of Java objects
-     * created by digesting fileURL
-     */
-    public static Object load(URL digesterRules, ClassLoader classLoader,
-                              InputStream input, Object rootObject) throws IOException, SAXException,
-            DigesterLoadingException {
-        Digester digester = createDigester(digesterRules);
-        digester.setClassLoader(classLoader);
-        digester.push(rootObject);
-        try {
-            return digester.parse(input);
-        } catch (XmlLoadException ex) {
+     * @param rootObject an Object to push onto the digester's stack, prior to parsing the
input
+     * @return an Object which is the root of the network of Java objects created by digesting
fileURL
+     */
+    public static Object load( URL digesterRules, ClassLoader classLoader, InputStream input,
Object rootObject )
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        Digester digester = createDigester( digesterRules );
+        digester.setClassLoader( classLoader );
+        digester.push( rootObject );
+        try
+        {
+            return digester.parse( input );
+        }
+        catch ( XmlLoadException ex )
+        {
             // This is a runtime exception that can be thrown by
             // FromXmlRuleSet#addRuleInstances, which is called by the Digester
             // before it parses the file.
-            throw new DigesterLoadingException(ex.getMessage(), ex);
+            throw new DigesterLoadingException( ex.getMessage(), ex );
         }
     }
-    
+
     /**
-     * Given the digester rules XML file, a class loader, and an input stream,
-     * this method parses the input into Java objects. The class loader
-     * is used by the digester to create the Java objects.
+     * Given the digester rules XML file, a class loader, and an input stream, this method
parses the input into Java
+     * objects. The class loader is used by the digester to create the Java objects.
+     * 
      * @param digesterRules URL to the XML document defining the digester rules
      * @param classLoader the ClassLoader to register with the digester
      * @param input Reader over the XML file to parse into Java objects
-     * @param rootObject an Object to push onto the digester's stack, prior
-     * to parsing the input
-     * @return an Object which is the root of the network of Java objects
-     * created by digesting fileURL
-     */
-    public static Object load(
-                                URL digesterRules, 
-                                ClassLoader classLoader,
-                                Reader input, 
-                                Object rootObject) 
-                                    throws 
-                                        IOException, 
-                                        SAXException,
-                                        DigesterLoadingException {
-        Digester digester = createDigester(digesterRules);
-        digester.setClassLoader(classLoader);
-        digester.push(rootObject);
-        try {
-            return digester.parse(input);
-        } catch (XmlLoadException ex) {
+     * @param rootObject an Object to push onto the digester's stack, prior to parsing the
input
+     * @return an Object which is the root of the network of Java objects created by digesting
fileURL
+     */
+    public static Object load( URL digesterRules, ClassLoader classLoader, Reader input,
Object rootObject )
+        throws IOException, SAXException, DigesterLoadingException
+    {
+        Digester digester = createDigester( digesterRules );
+        digester.setClassLoader( classLoader );
+        digester.push( rootObject );
+        try
+        {
+            return digester.parse( input );
+        }
+        catch ( XmlLoadException ex )
+        {
             // This is a runtime exception that can be thrown by
             // FromXmlRuleSet#addRuleInstances, which is called by the Digester
             // before it parses the file.
-            throw new DigesterLoadingException(ex.getMessage(), ex);
+            throw new DigesterLoadingException( ex.getMessage(), ex );
         }
     }
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoadingException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoadingException.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoadingException.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/DigesterLoadingException.java
Thu May 12 18:03:26 2011
@@ -16,33 +16,36 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3.xmlrules;
 
-
 /**
  * Thrown when an error occurs while parsing XML into Digester rules.
- *
+ * 
  * @since 1.2
  */
 
-public class DigesterLoadingException extends Exception {
+public class DigesterLoadingException
+    extends Exception
+{
 
     private static final long serialVersionUID = 1L;
+
     private Throwable cause = null;
 
     /**
      * @param msg a String detailing the reason for the exception
      */
-    public DigesterLoadingException(String msg) {
-        super(msg);
+    public DigesterLoadingException( String msg )
+    {
+        super( msg );
     }
 
     /**
      * @param cause underlying exception that caused this to be thrown
      */
-    public DigesterLoadingException(Throwable cause) {
-        this(cause.getMessage());
+    public DigesterLoadingException( Throwable cause )
+    {
+        this( cause.getMessage() );
         this.cause = cause;
     }
 
@@ -50,19 +53,20 @@ public class DigesterLoadingException ex
      * @param msg a String detailing the reason for the exception
      * @param cause underlying exception that caused this to be thrown
      */
-    public DigesterLoadingException(String msg, Throwable cause) {
-        this(msg);
+    public DigesterLoadingException( String msg, Throwable cause )
+    {
+        this( msg );
         this.cause = cause;
     }
 
     /**
-     * Return the cause of this exception (if any) as specified in the
-     * exception constructor.
+     * Return the cause of this exception (if any) as specified in the exception constructor.
      * 
      * @since 1.8
      */
     @Override
-    public Throwable getCause() {
+    public Throwable getCause()
+    {
         return cause;
     }
 }



Mime
View raw message