Here is the context in which I looked into the JBoss file protocol handler not being 
used.
As far as I remember, the issue was that very early on there are file URLs being
created and these were picking up the default file protocol handler. Recreating the
URL after the URLStreamHandlerFactory was installed resulted in the JBoss file
protocol handler being used.

xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx

----- Original Message ----- 
From: "Scott M Stark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 29, 2002 12:05 PM
Subject: [jboss-cvs] jboss-common/src/main/org/jboss/net/protocol/resource 
ResourceURLConnection.java


>   User: starksm 
>   Date: 02/09/29 13:05:18
> 
>   Modified:    src/main/org/jboss/net/protocol/resource Tag: Branch_3_0
>                         ResourceURLConnection.java
>   Log:
>   Recreate the URL obtained from the class loader as the file URLs are not
>   using the org.jboss.net.protocol.file handler for some reason. Creating a
>   new URL from the CL URL string does use our URLStreamHandlerFactory. This
>   fixes a problem with the log4j.xml file changes not being seen due to
>   the invalid lastModified of the default sun file protocol handler.
>   
>   Revision  Changes    Path
>   No                   revision
>   
>   
>   No                   revision
>   
>   
>   1.2.2.2   +17 -5     
>jboss-common/src/main/org/jboss/net/protocol/resource/ResourceURLConnection.java
>   
>   Index: ResourceURLConnection.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jboss-common/src/main/org/jboss/net/protocol/resource/ResourceURLConnection.java,v
>   retrieving revision 1.2.2.1
>   retrieving revision 1.2.2.2
>   diff -u -r1.2.2.1 -r1.2.2.2
>   --- ResourceURLConnection.java 17 May 2002 22:25:41 -0000 1.2.2.1
>   +++ ResourceURLConnection.java 29 Sep 2002 20:05:18 -0000 1.2.2.2
>   @@ -22,7 +22,7 @@
>    /**
>     * Provides access to system resources as a URLConnection.
>     *
>   - * @version <tt>$Revision: 1.2.2.1 $</tt>
>   + * @version <tt>$Revision: 1.2.2.2 $</tt>
>     * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
>     */
>    public class ResourceURLConnection
>   @@ -50,7 +50,8 @@
>          ClassLoader cl = Thread.currentThread().getContextClassLoader();
>          URL target = cl.getResource(name);
>    
>   -      if (target == null) {
>   +      if (target == null)
>   +      {
>             cl = ClassLoader.getSystemClassLoader();
>             target = cl.getResource(name);
>          }
>   @@ -58,12 +59,23 @@
>          if (target == null)
>             throw new FileNotFoundException("Could not locate resource: " + name);
>    
>   -      if (log.isTraceEnabled()) {
>   +      /* The file URLs being returned by the class loaders are not using the
>   +         org.jboss.net.protocol.file handler for some reason so here we
>   +         recreate the url to make sure it goes through our
>   +         URLStreamHandlerFactory. The cause should be tracked down but this
>   +         works for now.
>   +      */
>   +      String urlStr = target.toString();
>   +      target = new URL(urlStr);
>   +      if (log.isTraceEnabled())
>   +      {
>             log.trace("Target resource URL: " + target);
>   -         try {
>   +         try
>   +         {
>                log.trace("Target resource URL connection: " + 
>target.openConnection());
>             }
>   -         catch (Exception ignore) {}
>   +         catch (Exception ignore)
>   +         {}
>          }
>          
>          return target;



-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving 
your online business a competitive advantage. Test-drive a Thawte SSL 
certificate - our easy online guide will show you how. Click here to get 
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to