Revision: 19984
          http://sourceforge.net/p/gate/code/19984
Author:   markagreenwood
Date:     2017-01-25 13:51:29 +0000 (Wed, 25 Jan 2017)
Log Message:
-----------
removed the creole:// url handler as we discovered this morning that it's a 
none starter for web apps etc.

Modified Paths:
--------------
    gate/branches/sawdust2/gate-core/src/main/java/gate/Plugin.java
    gate/branches/sawdust2/gate-core/src/main/java/gate/util/maven/Utils.java

Removed Paths:
-------------
    gate/branches/sawdust2/gate-core/src/main/java/sun/

Modified: gate/branches/sawdust2/gate-core/src/main/java/gate/Plugin.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/Plugin.java     
2017-01-25 13:03:14 UTC (rev 19983)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/Plugin.java     
2017-01-25 13:51:29 UTC (rev 19984)
@@ -91,94 +91,6 @@
   
   protected static final Logger log = Logger.getLogger(Plugin.class);
   
-  private static class URLHandlerFactory implements URLStreamHandlerFactory {
-
-    private URLStreamHandlerFactory delegate;
-    
-    public URLHandlerFactory() {
-      delegate = null;
-    }
-    
-    public URLHandlerFactory(URLStreamHandlerFactory current) {
-      this.delegate = current;
-    }
-    
-    @Override
-    public URLStreamHandler createURLStreamHandler(String protocol) {
-      if(delegate != null) {
-        // if there was already a factory then delegate to it first to see
-        // if it can handle the protocol
-        URLStreamHandler handler =
-            delegate.createURLStreamHandler(protocol);
-
-        // if so our work here is done
-        if(handler != null) return handler;
-      }
-
-      // build up the normal classname from the protocol
-      String className = "sun.net.www.protocol." + protocol + ".Handler";
-
-      try {
-        // try to load the class
-        Class<?> handler = Class.forName(className);
-
-        // create and return an instance of the protocol handler
-        return (URLStreamHandler)handler.newInstance();
-
-      } catch(ClassNotFoundException | InstantiationException
-          | IllegalAccessException e) {
-        // skip over this to the null return;
-      }
-
-      // either there is no handler for the protocol or something went
-      // wrong, either way just return null
-      return null;
-    }
-    
-  }
-  
-  static {
-
-    if(!Plugin.class.getClassLoader()
-        .equals(ClassLoader.getSystemClassLoader())) {
-      // we only need to register the factory if the handler classes are not
-      // already on the system classloader
-
-      log.debug("registering URLStreamHandlerFactory");
-      
-      try {
-        URL.setURLStreamHandlerFactory(new URLHandlerFactory());
-      }
-      catch (Error error) {
-
-        Field factoryField = null;
-
-        try {
-          // get the factory field from java.net.URL via reflection
-          factoryField = URL.class.getDeclaredField("factory");
-
-          // it's usually package protected but we need access to it
-          factoryField.setAccessible(true);
-
-          URLStreamHandlerFactory delegate = 
(URLStreamHandlerFactory)factoryField.get(null);
-
-          // make sure the factory field is set to null so that setting it 
won't
-          // cause an exception
-          factoryField.set(null, null);
-
-          // register our delegating factory
-          URL.setURLStreamHandlerFactory(new URLHandlerFactory(delegate));
-        } catch(NoSuchFieldException | IllegalAccessException e) {
-          //this is a problem as it means our custom protocol handlers aren't 
going to get used
-          e.printStackTrace();
-        } finally {
-          // make sure we put the field back the way it was before we started
-          if(factoryField != null) factoryField.setAccessible(false);
-        }
-      }      
-    }
-  }
-
   /**
    * Is the plugin valid (i.e. is the location reachable and the
    * creole.xml file parsable).
@@ -623,12 +535,14 @@
           repoSystem.resolveArtifact(repoSession,
                       artifactRequest);
       
-      baseURL = new URI("creole://"+group+";"+artifact+";"+version+"/");
+      //baseURL = new URI("creole://"+group+";"+artifact+";"+version+"/");
             
       artifactURL =
               new URL("jar:"
                       + artifactResult.getArtifact().getFile().toURI().toURL()
                       + "!/");
+      
+      baseURL = artifactURL.toURI();
 
       // check it has a creole.xml at the root
       URL directoryXmlFileUrl = new URL(artifactURL, "creole.xml");

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/maven/Utils.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/util/maven/Utils.java   
2017-01-25 13:03:14 UTC (rev 19983)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/util/maven/Utils.java   
2017-01-25 13:51:29 UTC (rev 19984)
@@ -137,7 +137,7 @@
     }
 
     LocalRepository localRepo = new LocalRepository(repoLocation);
-    log.info("Using local repository at: " + repoLocation);
+    log.debug("Using local repository at: " + repoLocation);
     repoSystemSession.setLocalRepositoryManager(repoSystem
             .newLocalRepositoryManager(repoSystemSession, localRepo));
     

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to