Return-Path: X-Original-To: apmail-cocoon-cvs-archive@www.apache.org Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB505D662 for ; Sun, 16 Sep 2012 19:05:13 +0000 (UTC) Received: (qmail 98764 invoked by uid 500); 16 Sep 2012 19:05:13 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 98683 invoked by uid 500); 16 Sep 2012 19:05:13 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 98673 invoked by uid 99); 16 Sep 2012 19:05:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Sep 2012 19:05:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Sep 2012 19:05:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F383F23888E3 for ; Sun, 16 Sep 2012 19:04:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1385349 - /cocoon/subprojects/cocoon-jnet/trunk/src/main/java/org/apache/cocoon/jnet/URLStreamHandlerFactoryInstaller.java Date: Sun, 16 Sep 2012 19:04:25 -0000 To: cvs@cocoon.apache.org From: thorsten@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120916190425.F383F23888E3@eris.apache.org> 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);