You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jeff Caddel <jc...@cox.net> on 2003/11/06 22:55:44 UTC
[chain] Patch for ChainResources
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
Re: [chain] Patch for ChainResources
Posted by "Craig R. McClanahan" <cr...@apache.org>.
Quoting Jeff Caddel <jc...@cox.net>:
> 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.
>
I've applied your patch ... thanks!
> This is a great API by the way! It's lending itself very well to
> getting my business logic organized.
I'd be interested in any example usage patterns that you'd be willing to
describe, so we can ultimately create some "best practices" documentation.
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org