commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Caddel <jcad...@cox.net>
Subject [chain] Patch for ChainResources
Date Thu, 06 Nov 2003 21:55:44 GMT
ChainListener fails to initialize correctly if you leave out either of 
the two optional config parameters CONFIG_CLASS_RESOURCE or 
CONFIG_WEB_RESOURCE. 

The exception occurs in ChainResources when it tries to parse the comma 
separated list of resources passed in to it.  If the list of resources 
is null things go awry. 

This patch alters ChainResources methods to return instead of attempting 
to parse if the resources passed into it are null. 

Another way to handle it would be to alter ChainListener so that it 
doesn't invoke ChainResources if it detects that it's initialization 
parameters haven't been set.

This is a great API by the way!  It's lending itself very well to 
getting my business logic organized.



Index: ChainResources.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/web/ChainResources.java,v
retrieving revision 1.3
diff -u -r1.3 ChainResources.java
--- ChainResources.java 20 Oct 2003 17:12:07 -0000 1.3
+++ ChainResources.java 6 Nov 2003 21:30:29 -0000
@@ -104,6 +104,10 @@
      */
     static void parseClassResources(Catalog catalog, String resources,
                                     ConfigParser parser) {
+                                      
+     if (resources == null) {
+        return;                                      
+     }
 
         ClassLoader loader =
             Thread.currentThread().getContextClassLoader();
@@ -155,6 +159,10 @@
                                   String resources,
                                   ConfigParser parser) {
 
+     if (resources == null) {
+        return;                                      
+     }
+     
         String path = null;
         try {
             while (true) {



---------------------------------------------------------------------
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