On 3/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: hermod
Date: Wed Mar 14 04:43:53 2007
New Revision: 518103
URL: http://svn.apache.org/viewvc?view=rev&rev=518103
Log:
Added fix for SHALE-424. ComponentConfigBean now checks it the config file is
empty before trying to create a URL from it
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java?view=diff&rev=518103&r1=518102&r2=518103
==============================================================================
---
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
(original)
+++
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
Wed Mar 14 04:43:53 2007
@@ -37,6 +37,7 @@
import javax.servlet.ServletContext;
+import org.apache.commons.lang.StringUtils;
<snip/>
I think we should inline the StringUtils.isEmpty(String) call below.
This will avoid an explicit dependency on Commons Lang, which is
probably good unless we find ourselves inlining many bits, and over
and over.
Apparently, the only reason this builds is because Commons Lang is
pulled in transitively? (don't think we have an explicit <dependency>
for it).
-Rahul
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.ClayConfigParser;
@@ -270,12 +271,15 @@
urls.add(ui.nextElement());
}
} else {
- URL url = context.getResource(configFile.toString());
- if (url == null) {
- throw new
PageNotFoundException(messages.getMessage("file.notfound",
- new Object[] {configFile.toString()}),
configFile.toString());
- }
+ if(configFile!=null &&
!StringUtils.isEmpty(configFile.toString()))
+ {
+ URL url = context.getResource(configFile.toString());
+ if (url == null) {
+ throw new
PageNotFoundException(messages.getMessage("file.notfound",
+ new Object[] {configFile.toString()}),
configFile.toString());
+ }
urls.add(url);
+ }
}
} catch (IOException e) {
log.error(e);