>From: "Rahul Akolkar" <[EMAIL PROTECTED]> > > On 3/14/07, [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/bean > > s/ComponentConfigBean.java > > > > Modified: > shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/bean > > s/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/bean > > s/ComponentConfigBean.java (original) > > +++ > shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/bean > > s/ComponentConfigBean.java Wed Mar 14 04:43:53 2007 > > @@ -37,6 +37,7 @@ > > > > import javax.servlet.ServletContext; > > > > +import org.apache.commons.lang.StringUtils; > > > 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 > for it). >
Yeah, I guess it must be a transitive dependency. I agree. It is a handy method but doesn't saves much here. This looks like another thing that C# ripped off :-) string.Empty > -Rahul > > Gary > > > 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); > > > > > >