cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r906607 - in /cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet: DynamicURLStreamHandlerFactory.java URLHandlerFactoryCollector.java
Date Thu, 04 Feb 2010 18:55:09 GMT
Author: reinhard
Date: Thu Feb  4 18:55:09 2010
New Revision: 906607

URL: http://svn.apache.org/viewvc?rev=906607&view=rev
Log:
Java 5 language features

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

Modified: cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/DynamicURLStreamHandlerFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/DynamicURLStreamHandlerFactory.java?rev=906607&r1=906606&r2=906607&view=diff
==============================================================================
--- cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/DynamicURLStreamHandlerFactory.java
(original)
+++ cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/DynamicURLStreamHandlerFactory.java
Thu Feb  4 18:55:09 2010
@@ -24,7 +24,7 @@
 
 public class DynamicURLStreamHandlerFactory implements URLStreamHandlerFactory {
 
-    private static final ThreadLocal FACTORIES = new InheritableThreadLocal();
+    private static final ThreadLocal<List<URLStreamHandlerFactory>> FACTORIES
= new InheritableThreadLocal<List<URLStreamHandlerFactory>>();
 
     public static void pop() {
         getList().remove(0);
@@ -34,11 +34,11 @@
         getList().add(0, factory);
     }
 
-    private static List getList() {
-        List list = (List) FACTORIES.get();
+    private static List<URLStreamHandlerFactory> getList() {
+        List<URLStreamHandlerFactory> list = FACTORIES.get();
 
         if (list == null) {
-            list = new LinkedList();
+            list = new LinkedList<URLStreamHandlerFactory>();
             FACTORIES.set(list);
         }
 
@@ -51,10 +51,10 @@
      * @see java.net.URLStreamHandlerFactory#createURLStreamHandler(java.lang.String)
      */
     public URLStreamHandler createURLStreamHandler(String protocol) {
-        List list = getList();
+        List<URLStreamHandlerFactory> list = getList();
 
-        for (Iterator i = list.iterator(); i.hasNext();) {
-            URLStreamHandler handler = ((URLStreamHandlerFactory)i.next()).createURLStreamHandler(protocol);
+        for (Iterator<URLStreamHandlerFactory> i = list.iterator(); i.hasNext();) {
+            URLStreamHandler handler = i.next().createURLStreamHandler(protocol);
 
             if (handler != null) {
                 return handler;

Modified: cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/URLHandlerFactoryCollector.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/URLHandlerFactoryCollector.java?rev=906607&r1=906606&r2=906607&view=diff
==============================================================================
--- cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/URLHandlerFactoryCollector.java
(original)
+++ cocoon/trunk/subprojects/cocoon-jnet/src/main/java/org/apache/cocoon/jnet/URLHandlerFactoryCollector.java
Thu Feb  4 18:55:09 2010
@@ -27,38 +27,39 @@
 
 public class URLHandlerFactoryCollector {
 
-    private Map urlHandlerFactories = Collections.EMPTY_MAP;
+    private Map<String, URLStreamHandlerFactory> urlHandlerFactories = Collections.emptyMap();
 
     private boolean urlStreamHandlerInstalled;
 
     public Object installURLHandlers(ProceedingJoinPoint proceedingJoinPoint) throws Throwable
{
         try {
-            pushUrlHandlerFactories();
+            this.pushUrlHandlerFactories();
             return proceedingJoinPoint.proceed();
         } finally {
-            popUrlHandlerFactories();
+            this.popUrlHandlerFactories();
         }
     }
-    
+
     public void pushUrlHandlerFactories() throws Exception {
         if (!this.urlStreamHandlerInstalled) {
             URLStreamHandlerFactoryInstaller.setURLStreamHandlerFactory(new DynamicURLStreamHandlerFactory());
             this.urlStreamHandlerInstalled = true;
         }
 
-        for (Iterator i = this.urlHandlerFactories.values().iterator(); i.hasNext();) {
-            URLStreamHandlerFactory streamHandlerFactory = (URLStreamHandlerFactory) i.next();
+        for (Iterator<URLStreamHandlerFactory> i = this.urlHandlerFactories.values().iterator();
i.hasNext();) {
+            URLStreamHandlerFactory streamHandlerFactory = i.next();
             DynamicURLStreamHandlerFactory.push(streamHandlerFactory);
         }
     }
-    
+
     public void popUrlHandlerFactories() {
-        for (Iterator i = this.urlHandlerFactories.values().iterator(); i.hasNext(); i.next())
{
+        for (Iterator<URLStreamHandlerFactory> i = this.urlHandlerFactories.values().iterator();
i.hasNext(); i
+                .next()) {
             DynamicURLStreamHandlerFactory.pop();
         }
     }
 
-    public void setUrlHandlerFactories(Map urlHandlerFactories) {
+    public void setUrlHandlerFactories(Map<String, URLStreamHandlerFactory> urlHandlerFactories)
{
         this.urlHandlerFactories = urlHandlerFactories;
     }
 }



Mime
View raw message