[jboss-user] [Microcontainer] - Re: VFS & Commons Configuration issue

past do-not-reply at jboss.com
Tue Apr 14 06:39:57 EDT 2009


Essentially the FileChangedReloadingStrategy from Commons Configuration was doing this:

private File fileFromURL(URL url)
  | {
  |     if (JAR_PROTOCOL.equals(url.getProtocol()))
  |     {
  |         String path = url.getPath();
  |         try
  |         {
  |             return ConfigurationUtils.fileFromURL(new URL(path.substring(0,
  |                     path.indexOf('!'))));
  |         }
  |         catch (MalformedURLException mex)
  |         {
  |             return null;
  |         }
  |     }
  |     else
  |     {
  |         return ConfigurationUtils.fileFromURL(url);
  |     }
  | }
  | 

I extended it as follows and it's working now:

private File fileFromURL(URL url)
  | {
  |     if (VFSFILE_PROTOCOL.equals(url.getProtocol()))
  |     {
  |         String path = url.getPath();
  |         try
  |         {
  |             return ConfigurationUtils.fileFromURL(new URL("file:" + path));
  |         }
  |         catch (MalformedURLException mex)
  |         {
  |             return null;
  |         }
  |     }
  |     else if (JAR_PROTOCOL.equals(url.getProtocol()))
  |     {
  |         String path = url.getPath();
  |         try
  |         {
  |             return ConfigurationUtils.fileFromURL(new URL(path.substring(0,
  |                     path.indexOf('!'))));
  |         }
  |         catch (MalformedURLException mex)
  |         {
  |             return null;
  |         }
  |     } else
  | 	return ConfigurationUtils.fileFromURL(url);
  | }
  | 

Can you see anything wrong with this approach?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225313#4225313

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225313



More information about the jboss-user mailing list