commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1032363 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs/ core/src/main/java/org/apache/commons/vfs/impl/ core/src/main/java/org/apache/commons/vfs/provider/zip/ examples/src/main/java/org/apache/commons/vfs/exampl...
Date Sun, 07 Nov 2010 19:36:58 GMT
Author: sebb
Date: Sun Nov  7 19:36:57 2010
New Revision: 1032363

URL: http://svn.apache.org/viewvc?rev=1032363&view=rev
Log:
Fix up generics

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemManager.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileReplicator.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/example/Shell.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/libcheck/SftpCheck.java
    commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeAttributesMap.java
    commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileObject.java
    commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileSystem.java
    commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/util/SharedRandomContentInputStream.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemManager.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemManager.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemManager.java
Sun Nov  7 19:36:57 2010
@@ -244,14 +244,14 @@ public interface FileSystemManager
      * Get the file object decorator used.
      * @return the file object decorator Class.
      */
-    Class getFileObjectDecorator();
+    Class<?> getFileObjectDecorator();
 
     /**
      * The constructor associated to the fileObjectDecorator.
      * We cache it here for performance reasons.
      * @return the Constructor associated with the FileObjectDecorator.
      */
-    Constructor getFileObjectDecoratorConst();
+    Constructor<?> getFileObjectDecoratorConst();
 
     /**
      * The class to use to determine the content-type (mime-type).
@@ -279,7 +279,7 @@ public interface FileSystemManager
      * @return A Collection of the various capabilities.
      * @throws FileSystemException if the given scheme is not konwn.
      */
-    Collection getProviderCapabilities(final String scheme) throws FileSystemException;
+    Collection<Capability> getProviderCapabilities(final String scheme) throws FileSystemException;
 
     /**
      * Sets the logger to use.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileReplicator.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileReplicator.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileReplicator.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileReplicator.java
Sun Nov  7 19:36:57 2010
@@ -51,7 +51,7 @@ public class DefaultFileReplicator
 
     private static final int MASK = 0xffff;
 
-    private final ArrayList copies = new ArrayList();
+    private final ArrayList<Object> copies = new ArrayList<Object>();
     private File tempDir;
     private long filecount;
     private boolean tempDirMessageLogged;

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
Sun Nov  7 19:36:57 2010
@@ -19,6 +19,7 @@ package org.apache.commons.vfs.impl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.vfs.CacheStrategy;
+import org.apache.commons.vfs.Capability;
 import org.apache.commons.vfs.FileContentInfoFactory;
 import org.apache.commons.vfs.FileName;
 import org.apache.commons.vfs.FileObject;
@@ -81,12 +82,12 @@ public class DefaultFileSystemManager im
     /**
      * Mapping from URI scheme to FileProvider.
      */
-    private final Map providers = new HashMap();
+    private final Map<String, FileProvider> providers = new HashMap<String, FileProvider>();
 
     /**
      * All components used by this manager.
      */
-    private final ArrayList components = new ArrayList();
+    private final ArrayList<Object> components = new ArrayList<Object>();
 
     /**
      * The base file to use for relative URI.
@@ -106,8 +107,8 @@ public class DefaultFileSystemManager im
     /**
      * Class which decorates all returned fileObjects
      */
-    private Class fileObjectDecorator;
-    private Constructor fileObjectDecoratorConst;
+    private Class<?> fileObjectDecorator;
+    private Constructor<?> fileObjectDecoratorConst;
 
     /**
      * The class to use to determine the content-type (mime-type)
@@ -130,7 +131,8 @@ public class DefaultFileSystemManager im
     private final VirtualFileProvider vfsProvider = new VirtualFileProvider();
     private boolean init;
 
-    private final Map operationProviders = new HashMap();
+    private final Map<String, List<FileOperationProvider>> operationProviders
= 
+          new HashMap<String, List<FileOperationProvider>>();
 
     /**
      * Returns the logger used by this manager.
@@ -304,7 +306,7 @@ public class DefaultFileSystemManager im
      * Get the file object decorator used.
      * @return The decorator.
      */
-    public Class getFileObjectDecorator()
+    public Class<?> getFileObjectDecorator()
     {
         return fileObjectDecorator;
     }
@@ -314,7 +316,7 @@ public class DefaultFileSystemManager im
      * We cache it here for performance reasons.
      * @return The decorator's Constructor.
      */
-    public Constructor getFileObjectDecoratorConst()
+    public Constructor<?> getFileObjectDecoratorConst()
     {
         return fileObjectDecoratorConst;
     }
@@ -326,7 +328,7 @@ public class DefaultFileSystemManager im
      * constructor with a single {@link FileObject} as argument
      * @throws FileSystemException if an error occurs setting the decorator.
      */
-    public void setFileObjectDecorator(Class fileObjectDecorator) throws FileSystemException
+    public void setFileObjectDecorator(Class<?> fileObjectDecorator) throws FileSystemException
     {
         if (init)
         {
@@ -519,7 +521,7 @@ public class DefaultFileSystemManager im
         }
 
         // Close the providers.
-        for (Iterator iterator = providers.values().iterator(); iterator
+        for (Iterator<?> iterator = providers.values().iterator(); iterator
                 .hasNext();)
         {
             final Object provider = iterator.next();
@@ -552,7 +554,7 @@ public class DefaultFileSystemManager im
         }
 
         // Close the providers.
-        for (Iterator iterator = providers.values().iterator(); iterator
+        for (Iterator<FileProvider> iterator = providers.values().iterator(); iterator
                 .hasNext();)
         {
             final AbstractFileProvider provider = (AbstractFileProvider) iterator
@@ -686,7 +688,7 @@ public class DefaultFileSystemManager im
         if (scheme != null)
         {
             // An absolute URI - locate the provider
-            final FileProvider provider = (FileProvider) providers.get(scheme);
+            final FileProvider provider = providers.get(scheme);
             if (provider != null)
             {
                 return provider.findFile(realBaseFile, uri, fileSystemOptions);
@@ -801,7 +803,7 @@ public class DefaultFileSystemManager im
             scheme = realBase.getScheme();
             fullPath = realBase.getRootURI() + resolvedPath;
         }
-        final FileProvider provider = (FileProvider) providers.get(scheme);
+        final FileProvider provider = providers.get(scheme);
         if (provider != null)
         {
             // todo: extend the filename parser to be able to parse
@@ -847,7 +849,7 @@ public class DefaultFileSystemManager im
         if (scheme != null)
         {
             // An absolute URI - locate the provider
-            final FileProvider provider = (FileProvider) providers.get(scheme);
+            final FileProvider provider = providers.get(scheme);
             if (provider != null)
             {
                 return provider.parseUri(null, uri);
@@ -904,7 +906,7 @@ public class DefaultFileSystemManager im
     public FileObject createFileSystem(final String scheme,
             final FileObject file) throws FileSystemException
     {
-        final FileProvider provider = (FileProvider) providers.get(scheme);
+        final FileProvider provider = providers.get(scheme);
         if (provider == null)
         {
             throw new FileSystemException("vfs.impl/unknown-provider.error",
@@ -1014,8 +1016,7 @@ public class DefaultFileSystemManager im
      */
     public void _closeFileSystem(FileSystem filesystem)
     {
-        FileProvider provider = (FileProvider) providers.get(filesystem
-                .getRootName().getScheme());
+        FileProvider provider = providers.get(filesystem.getRootName().getScheme());
         if (provider != null)
         {
             ((AbstractFileProvider) provider).closeFileSystem(filesystem);
@@ -1030,7 +1031,7 @@ public class DefaultFileSystemManager im
     {
         public URLStreamHandler createURLStreamHandler(final String protocol)
         {
-            FileProvider provider = (FileProvider) providers.get(protocol);
+            FileProvider provider = providers.get(protocol);
             if (provider != null)
             {
                 return new DefaultURLStreamHandler(context);
@@ -1059,10 +1060,10 @@ public class DefaultFileSystemManager im
      * @return A Collection of capabilities.
      * @throws FileSystemException if the given scheme is not konwn
      */
-    public Collection getProviderCapabilities(final String scheme)
+    public Collection<Capability> getProviderCapabilities(final String scheme)
             throws FileSystemException
     {
-        FileProvider provider = (FileProvider) providers.get(scheme);
+        FileProvider provider = providers.get(scheme);
         if (provider == null)
         {
             throw new FileSystemException("vfs.impl/unknown-scheme.error",
@@ -1081,7 +1082,7 @@ public class DefaultFileSystemManager im
     public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme)
             throws FileSystemException
     {
-        FileProvider provider = (FileProvider) providers.get(scheme);
+        FileProvider provider = providers.get(scheme);
         if (provider == null)
         {
             throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[] {scheme});
@@ -1127,11 +1128,11 @@ public class DefaultFileSystemManager im
 
             if (!operationProviders.containsKey(scheme))
             {
-                final List providers = new ArrayList();
+                final List<FileOperationProvider> providers = new ArrayList<FileOperationProvider>();
                 operationProviders.put(scheme, providers);
             }
 
-            final List providers = (List) operationProviders.get(scheme);
+            final List<FileOperationProvider> providers = operationProviders.get(scheme);
 
             if (providers.contains(operationProvider))
             {
@@ -1160,11 +1161,11 @@ public class DefaultFileSystemManager im
             throws FileSystemException
     {
 
-        List providers = (List) operationProviders.get(scheme);
+        List<?> providers = operationProviders.get(scheme);
         if (providers == null || providers.size() == 0)
         {
             return null;
         }
-        return (FileOperationProvider[]) providers.toArray(new FileOperationProvider[] {});
+        return providers.toArray(new FileOperationProvider[] {});
     }
 }

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
Sun Nov  7 19:36:57 2010
@@ -139,7 +139,7 @@ public class StandardFileSystemManager
     {
         ClassLoader cl = findClassLoader();
 
-        Enumeration enumResources;
+        Enumeration<URL> enumResources;
         try
         {
             enumResources = cl.getResources(PLUGIN_CONFIG_RESOURCE);
@@ -151,7 +151,7 @@ public class StandardFileSystemManager
 
         while (enumResources.hasMoreElements())
         {
-            URL url = (URL) enumResources.nextElement();
+            URL url = enumResources.nextElement();
             configure(url);
         }
     }
@@ -221,6 +221,7 @@ public class StandardFileSystemManager
      * @param configStream An InputStream containing the configuration.
      * @throws FileSystemException if an error occurs.
      */
+    @SuppressWarnings("unused")
     private void configure(final String configUri, final InputStream configStream)
             throws FileSystemException
     {
@@ -423,7 +424,7 @@ public class StandardFileSystemManager
      */
     private String[] getRequiredClasses(final Element providerDef)
     {
-        final ArrayList classes = new ArrayList();
+        final ArrayList<String> classes = new ArrayList<String>();
         final NodeList deps = providerDef.getElementsByTagName("if-available");
         final int count = deps.getLength();
         for (int i = 0; i < count; i++)
@@ -435,7 +436,7 @@ public class StandardFileSystemManager
                 classes.add(className);
             }
         }
-        return (String[]) classes.toArray(new String[classes.size()]);
+        return classes.toArray(new String[classes.size()]);
     }
 
     /**
@@ -443,7 +444,7 @@ public class StandardFileSystemManager
      */
     private String[] getRequiredSchemes(final Element providerDef)
     {
-        final ArrayList schemes = new ArrayList();
+        final ArrayList<String> schemes = new ArrayList<String>();
         final NodeList deps = providerDef.getElementsByTagName("if-available");
         final int count = deps.getLength();
         for (int i = 0; i < count; i++)
@@ -455,7 +456,7 @@ public class StandardFileSystemManager
                 schemes.add(scheme);
             }
         }
-        return (String[]) schemes.toArray(new String[schemes.size()]);
+        return schemes.toArray(new String[schemes.size()]);
     }
 
     /**
@@ -463,7 +464,7 @@ public class StandardFileSystemManager
      */
     private String[] getSchemas(final Element provider)
     {
-        final ArrayList schemas = new ArrayList();
+        final ArrayList<String> schemas = new ArrayList<String>();
         final NodeList schemaElements = provider.getElementsByTagName("scheme");
         final int count = schemaElements.getLength();
         for (int i = 0; i < count; i++)
@@ -471,7 +472,7 @@ public class StandardFileSystemManager
             final Element scheme = (Element) schemaElements.item(i);
             schemas.add(scheme.getAttribute("name"));
         }
-        return (String[]) schemas.toArray(new String[schemas.size()]);
+        return schemas.toArray(new String[schemas.size()]);
     }
 
     /**
@@ -482,7 +483,7 @@ public class StandardFileSystemManager
     {
         try
         {
-            final Class clazz = findClassLoader().loadClass(className);
+            final Class<?> clazz = findClassLoader().loadClass(className);
             return clazz.newInstance();
         }
         catch (final Exception e)

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java
Sun Nov  7 19:36:57 2010
@@ -38,7 +38,7 @@ public class ZipFileObject
 {
     /** The ZipEntry. */
     protected ZipEntry entry;
-    private final HashSet children = new HashSet();
+    private final HashSet<String> children = new HashSet<String>();
     private final ZipFileSystem fs;
     // protected final ZipFile file;
 
@@ -129,7 +129,7 @@ public class ZipFileObject
             throw new RuntimeException(e);
         }
 
-        return (String[]) children.toArray(new String[children.size()]);
+        return children.toArray(new String[children.size()]);
     }
 
     /**

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
Sun Nov  7 19:36:57 2010
@@ -82,11 +82,11 @@ public class ZipFileSystem
         try
         {
             // Build the index
-            List strongRef = new ArrayList(100);
-            Enumeration entries = getZipFile().entries();
+            List<ZipFileObject> strongRef = new ArrayList<ZipFileObject>(100);
+            Enumeration<? extends ZipEntry> entries = getZipFile().entries();
             while (entries.hasMoreElements())
             {
-                ZipEntry entry = (ZipEntry) entries.nextElement();
+                ZipEntry entry = entries.nextElement();
                 FileName name = getFileSystemManager().resolveName(getRootName(), UriParser.encode(entry.getName()));
 
                 // Create the file

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/example/Shell.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/example/Shell.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/example/Shell.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/example/Shell.java
Sun Nov  7 19:36:57 2010
@@ -352,12 +352,12 @@ public class Shell
         {
             return null;
         }
-        final ArrayList cmd = new ArrayList();
+        final ArrayList<String> cmd = new ArrayList<String>();
         final StringTokenizer tokens = new StringTokenizer(line);
         while (tokens.hasMoreTokens())
         {
             cmd.add(tokens.nextToken());
         }
-        return (String[]) cmd.toArray(new String[cmd.size()]);
+        return cmd.toArray(new String[cmd.size()]);
     }
 }

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/libcheck/SftpCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/libcheck/SftpCheck.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/libcheck/SftpCheck.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs/libcheck/SftpCheck.java
Sun Nov  7 19:36:57 2010
@@ -80,8 +80,8 @@ public class SftpCheck
         session.connect();
         ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
         chan.connect();
-        Vector list = chan.ls(dir);
-        Iterator iterList = list.iterator();
+        Vector<?> list = chan.ls(dir);
+        Iterator<?> iterList = list.iterator();
         while (iterList.hasNext())
         {
             System.err.println(iterList.next());

Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeAttributesMap.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeAttributesMap.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeAttributesMap.java
(original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeAttributesMap.java
Sun Nov  7 19:36:57 2010
@@ -40,16 +40,16 @@ import java.util.TreeMap;
 /**
  * A map which tries to allow access to the various aspects of the mail
  */
-public class MimeAttributesMap implements Map
+public class MimeAttributesMap implements Map<String, Object>
 {
     private Log log = LogFactory.getLog(MimeAttributesMap.class);
 
     private final static String OBJECT_PREFIX = "obj.";
 
     private final Part part;
-    private Map backingMap;
+    private Map<String, Object> backingMap;
 
-    private final Map mimeMessageGetters = new TreeMap();
+    private final Map<String, Method> mimeMessageGetters = new TreeMap<String, Method>();
 
     public MimeAttributesMap(Part part)
     {
@@ -83,7 +83,7 @@ public class MimeAttributesMap implement
         }
     }
 
-    private Map getMap()
+    private Map<String, Object> getMap()
     {
         if (backingMap == null)
         {
@@ -93,14 +93,17 @@ public class MimeAttributesMap implement
         return backingMap;
     }
 
-    private Map createMap()
+    private Map<String, Object> createMap()
     {
-        Map ret = new TreeMap();
+        // Object is either a String, or a List of Strings
+        Map<String, Object> ret = new TreeMap<String, Object>();
 
-        Enumeration headers;
+        Enumeration<Header> headers;
         try
         {
-            headers = part.getAllHeaders();
+            @SuppressWarnings("unchecked") // Javadoc say Part returns Header
+            Enumeration<Header> allHeaders = part.getAllHeaders();
+            headers = allHeaders;
         }
         catch (MessagingException e)
         {
@@ -110,7 +113,7 @@ public class MimeAttributesMap implement
         // add all headers
         while (headers.hasMoreElements())
         {
-            Header header = (Header) headers.nextElement();
+            Header header = headers.nextElement();
             String headerName = header.getName();
 
             Object values = ret.get(headerName);
@@ -121,24 +124,26 @@ public class MimeAttributesMap implement
             }
             else if (values instanceof String)
             {
-                List newValues = new ArrayList();
-                newValues.add(values);
+                ArrayList<String> newValues = new ArrayList<String>();
+                newValues.add((String) values);
                 newValues.add(header.getValue());
                 ret.put(headerName, newValues);
             }
             else if (values instanceof List)
             {
-                ((List) values).add(header.getValue());
+                @SuppressWarnings("unchecked") // we only add Strings to the Lists
+                List<String> list = (List<String>) values;
+                list.add(header.getValue());
             }
         }
 
         // add all simple get/is results (with obj. prefix)
-        Iterator iterEntries = mimeMessageGetters.entrySet().iterator();
+        Iterator<Entry<String, Method>> iterEntries = mimeMessageGetters.entrySet().iterator();
         while (iterEntries.hasNext())
         {
-            Map.Entry entry = (Map.Entry) iterEntries.next();
-            String name = (String) entry.getKey();
-            Method method = (Method) entry.getValue();
+            Map.Entry<String, Method> entry = iterEntries.next();
+            String name = entry.getKey();
+            Method method = entry.getValue();
 
             try
             {
@@ -225,7 +230,7 @@ public class MimeAttributesMap implement
         return getMap().get(key);
     }
 
-    public Object put(Object key, Object value)
+    public Object put(String key, Object value)
     {
         throw new UnsupportedOperationException();
     }
@@ -235,7 +240,7 @@ public class MimeAttributesMap implement
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map t)
+    public void putAll(Map<? extends String, ? extends Object> t)
     {
         throw new UnsupportedOperationException();
     }
@@ -245,17 +250,17 @@ public class MimeAttributesMap implement
         throw new UnsupportedOperationException();
     }
 
-    public Set keySet()
+    public Set<String> keySet()
     {
         return Collections.unmodifiableSet(getMap().keySet());
     }
 
-    public Collection values()
+    public Collection<Object> values()
     {
         return Collections.unmodifiableCollection(getMap().values());
     }
 
-    public Set entrySet()
+    public Set<Entry<String, Object>> entrySet()
     {
         return Collections.unmodifiableSet(getMap().entrySet());
     }

Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileObject.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileObject.java
(original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileObject.java
Sun Nov  7 19:36:57 2010
@@ -24,6 +24,7 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 
+import javax.mail.Header;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
@@ -52,7 +53,7 @@ public class MimeFileObject
     implements FileObject
 {
     private Part part;
-    private Map attributeMap;
+    private Map<String, Object> attributeMap;
 
     protected MimeFileObject(final FileName name,
                             final Part part,
@@ -160,7 +161,7 @@ public class MimeFileObject
             return null;
         }
 
-        List vfs = new ArrayList();
+        List<MimeFileObject> vfs = new ArrayList<MimeFileObject>();
         if (isMultipart())
         {
             Object container = part.getContent();
@@ -189,7 +190,7 @@ public class MimeFileObject
             }
         }
 
-        return (MimeFileObject[]) vfs.toArray(new MimeFileObject[vfs.size()]);
+        return vfs.toArray(new MimeFileObject[vfs.size()]);
     }
 
     private void setPart(Part part)
@@ -287,7 +288,7 @@ public class MimeFileObject
      * </ul>
      */
     @Override
-    protected Map doGetAttributes() throws Exception
+    protected Map<String, Object> doGetAttributes() throws Exception
     {
         if (attributeMap == null)
         {
@@ -297,14 +298,15 @@ public class MimeFileObject
             }
             else
             {
-                attributeMap = Collections.EMPTY_MAP;
+                attributeMap = Collections.emptyMap();
             }
         }
 
         return attributeMap;
     }
 
-    protected Enumeration getAllHeaders() throws MessagingException
+    @SuppressWarnings("unchecked") // Javadoc says Part returns Header
+    protected Enumeration<Header> getAllHeaders() throws MessagingException
     {
         return part.getAllHeaders();
     }

Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileSystem.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileSystem.java
(original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/provider/mime/MimeFileSystem.java
Sun Nov  7 19:36:57 2010
@@ -70,7 +70,7 @@ public class MimeFileSystem
      * Returns the capabilities of this file system.
      */
     @Override
-    protected void addCapabilities(final Collection caps)
+    protected void addCapabilities(final Collection<Capability> caps)
     {
         caps.addAll(MimeFileProvider.capabilities);
     }

Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/util/SharedRandomContentInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/util/SharedRandomContentInputStream.java?rev=1032363&r1=1032362&r2=1032363&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/util/SharedRandomContentInputStream.java
(original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs/util/SharedRandomContentInputStream.java
Sun Nov  7 19:36:57 2010
@@ -36,7 +36,7 @@ import java.util.Set;
  */
 public class SharedRandomContentInputStream extends BufferedInputStream implements SharedInputStream
 {
-    private final Set createdStreams;
+    private final Set<SharedRandomContentInputStream> createdStreams;
     private final FileObject fo;
     private final long fileStart;
     private final long fileEnd;
@@ -44,7 +44,7 @@ public class SharedRandomContentInputStr
     private long pos;
     private long resetCount;
 
-    private SharedRandomContentInputStream(final Set createdStreams, final FileObject fo,
final long fileStart, final long fileEnd, final InputStream is) throws FileSystemException
+    private SharedRandomContentInputStream(final Set<SharedRandomContentInputStream>
createdStreams, final FileObject fo, final long fileStart, final long fileEnd, final InputStream
is) throws FileSystemException
     {
         super(is);
 
@@ -66,7 +66,7 @@ public class SharedRandomContentInputStr
 
     public SharedRandomContentInputStream(final FileObject fo) throws FileSystemException
     {
-        this(new HashSet(), fo, 0, -1, fo.getContent().getInputStream());
+        this(new HashSet<SharedRandomContentInputStream>(), fo, 0, -1, fo.getContent().getInputStream());
     }
 
 



Mime
View raw message