You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by th...@apache.org on 2012/09/16 21:04:25 UTC

svn commit: r1385349 - /cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java

Author: thorsten
Date: Sun Sep 16 19:04:25 2012
New Revision: 1385349

URL: http://svn.apache.org/viewvc?rev=1385349&view=rev
Log:
white noise - formating changes

Modified:
    cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java

Modified: cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java?rev=1385349&r1=1385348&r2=1385349&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java (original)
+++ cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java Sun Sep 16 19:04:25 2012
@@ -23,24 +23,30 @@ import java.net.URLStreamHandler;
 import java.net.URLStreamHandlerFactory;
 
 /**
- * The installer is a general purpose class to install an own {@link URLStreamHandlerFactory} in any environment.
+ * The installer is a general purpose class to install an own
+ * {@link URLStreamHandlerFactory} in any environment.
  */
 public class URLStreamHandlerFactoryInstaller {
 
-    public static void setURLStreamHandlerFactory(URLStreamHandlerFactory factory) throws Exception {
+    public static void setURLStreamHandlerFactory(
+            URLStreamHandlerFactory factory) throws Exception {
         try {
             // if we can set the factory, its the first!
-            URL.setURLStreamHandlerFactory(new ParentableURLStreamHandlerFactory(factory, null));
+            URL.setURLStreamHandlerFactory(new ParentableURLStreamHandlerFactory(
+                    factory, null));
         } catch (Error err) {
             ParentableURLStreamHandlerFactory currentFactory = getCurrentFactory();
-            setCurrentFactory(new ParentableURLStreamHandlerFactory(factory, currentFactory));
+            setCurrentFactory(new ParentableURLStreamHandlerFactory(factory,
+                    currentFactory));
         }
     }
 
-    private static ParentableURLStreamHandlerFactory getCurrentFactory() throws Exception {
+    private static ParentableURLStreamHandlerFactory getCurrentFactory()
+            throws Exception {
         Field factoryField = getFactoryField();
 
-        URLStreamHandlerFactory currentFactory = (URLStreamHandlerFactory) factoryField.get(null);
+        URLStreamHandlerFactory currentFactory = (URLStreamHandlerFactory) factoryField
+                .get(null);
         if (currentFactory instanceof ParentableURLStreamHandlerFactory) {
             return (ParentableURLStreamHandlerFactory) currentFactory;
         }
@@ -54,34 +60,42 @@ public class URLStreamHandlerFactoryInst
 
         for (int i = 0; i < fields.length; i++) {
             Field current = fields[i];
-            if (Modifier.isStatic(current.getModifiers()) && current.getType().equals(URLStreamHandlerFactory.class)) {
+            if (Modifier.isStatic(current.getModifiers())
+                    && current.getType().equals(URLStreamHandlerFactory.class)) {
                 current.setAccessible(true);
                 return current;
             }
         }
 
-        throw new Exception("Unable to detect static field in the URL class for the URLStreamHandlerFactory."
-                + " Please report this error together with your exact environment to the Apache Excalibur project.");
+        throw new Exception(
+                "Unable to detect static field in the URL class for the URLStreamHandlerFactory."
+                        + " Please report this error together with your exact environment to the Apache Excalibur project.");
     }
 
-    private static void setCurrentFactory(ParentableURLStreamHandlerFactory parentableURLStreamHandlerFactory) throws Exception {
+    private static void setCurrentFactory(
+            ParentableURLStreamHandlerFactory parentableURLStreamHandlerFactory)
+            throws Exception {
         Field factoryField = getFactoryField();
         factoryField.set(null, parentableURLStreamHandlerFactory);
     }
 
-    private static class ParentableURLStreamHandlerFactory implements URLStreamHandlerFactory {
+    private static class ParentableURLStreamHandlerFactory implements
+            URLStreamHandlerFactory {
 
         private final URLStreamHandlerFactory factory;
         private final ParentableURLStreamHandlerFactory parent;
 
-        public ParentableURLStreamHandlerFactory(URLStreamHandlerFactory factory, ParentableURLStreamHandlerFactory parent) {
+        public ParentableURLStreamHandlerFactory(
+                URLStreamHandlerFactory factory,
+                ParentableURLStreamHandlerFactory parent) {
             super();
             this.parent = parent;
             this.factory = factory;
         }
 
         public URLStreamHandler createURLStreamHandler(String protocol) {
-            URLStreamHandler handler = this.factory.createURLStreamHandler(protocol);
+            URLStreamHandler handler = this.factory
+                    .createURLStreamHandler(protocol);
 
             if (handler == null && this.parent != null) {
                 handler = this.parent.createURLStreamHandler(protocol);