commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs Resources.properties
Date Sun, 27 Oct 2002 08:16:20 GMT
adammurdoch    2002/10/27 01:16:20

  Modified:    vfs/src/java/org/apache/commons/vfs/impl VFSClassLoader.java
               vfs/src/java/org/apache/commons/vfs/provider/jar
                        JarFileObject.java JarURLConnectionImpl.java
               vfs/src/java/org/apache/commons/vfs/provider
                        AbstractFileObject.java DefaultFileContent.java
                        DefaultURLConnection.java
                        DefaultURLStreamHandler.java
               vfs/src/java/org/apache/commons/vfs Resources.properties
  Log:
  Tidy up exception handling, now that FileSystemException is an IOException.
  
  Revision  Changes    Path
  1.7       +7 -9      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/VFSClassLoader.java
  
  Index: VFSClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/VFSClassLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VFSClassLoader.java	23 Oct 2002 11:59:40 -0000	1.6
  +++ VFSClassLoader.java	27 Oct 2002 08:16:20 -0000	1.7
  @@ -170,11 +170,7 @@
               }
               return defineClass( name, res );
           }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ClassNotFoundException( name, fse );
  -        }
  -        catch ( IOException ioe )
  +        catch ( final IOException ioe )
           {
               throw new ClassNotFoundException( name, ioe );
           }
  @@ -183,8 +179,8 @@
       /**
        * Loads and verifies the class with name and located with res.
        */
  -    private Class defineClass( String name, Resource res )
  -        throws IOException, FileSystemException
  +    private Class defineClass( final String name, final Resource res )
  +        throws IOException
       {
           URL url = res.getCodeSourceURL();
   
  @@ -226,7 +222,9 @@
       /**
        * Reads attributes for the package and defines it.
        */
  -    private Package definePackage( String name, Resource res, URL url )
  +    private Package definePackage( final String name,
  +                                   final Resource res,
  +                                   final URL url )
           throws FileSystemException
       {
           URL sealBase = null;
  
  
  
  1.5       +18 -19    jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/jar/JarFileObject.java
  
  Index: JarFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/jar/JarFileObject.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JarFileObject.java	23 Oct 2002 13:09:10 -0000	1.4
  +++ JarFileObject.java	27 Oct 2002 08:16:20 -0000	1.5
  @@ -86,6 +86,9 @@
           super( name, entry, zipFile, fs );
       }
   
  +    /**
  +     * Returns the Jar manifest.
  +     */
       Manifest getManifest() throws IOException
       {
           if ( file == null )
  @@ -96,6 +99,9 @@
           return ( (JarFile)file ).getManifest();
       }
   
  +    /**
  +     * Returns the attributes of this file.
  +     */
       Attributes getAttributes() throws IOException
       {
           if ( attributes == null )
  @@ -118,28 +124,21 @@
       }
   
       /**
  -     *
  +     * Returns the value of an attribute.
        */
  -    protected Object doGetAttribute( String attrName )
  -        throws FileSystemException
  +    protected Object doGetAttribute( final String attrName )
  +        throws Exception
       {
  -        try
  -        {
  -            final JarFileSystem fs = (JarFileSystem)getFileSystem();
  -            final Attributes attr = getAttributes();
  -            final Name name = fs.lookupName( attrName );
  -            String value = attr.getValue( name );
  -            if ( value != null )
  -            {
  -                return value;
  -            }
  -
  -            return fs.getAttribute( name );
  -        }
  -        catch ( IOException ioe )
  +        final JarFileSystem fs = (JarFileSystem)getFileSystem();
  +        final Attributes attr = getAttributes();
  +        final Name name = fs.lookupName( attrName );
  +        String value = attr.getValue( name );
  +        if ( value != null )
           {
  -            throw new FileSystemException( attrName, ioe );
  +            return value;
           }
  +
  +        return fs.getAttribute( name );
       }
   
       /**
  
  
  
  1.6       +5 -19     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/jar/JarURLConnectionImpl.java
  
  Index: JarURLConnectionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/jar/JarURLConnectionImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JarURLConnectionImpl.java	23 Oct 2002 11:59:41 -0000	1.5
  +++ JarURLConnectionImpl.java	27 Oct 2002 08:16:20 -0000	1.6
  @@ -115,7 +115,7 @@
   
       public JarFile getJarFile() throws IOException
       {
  -        throw new UnsupportedOperationException( "vfs.provider.jar/jar-file-no-access.error"
);
  +        throw new FileSystemException( "vfs.provider.jar/jar-file-no-access.error" );
       }
   
   
  @@ -127,7 +127,7 @@
   
       public JarEntry getJarEntry() throws IOException
       {
  -        throw new UnsupportedOperationException( "vfs.provider.jar/jar-entry-no-access.error"
);
  +        throw new FileSystemException( "vfs.provider.jar/jar-entry-no-access.error" );
       }
   
   
  @@ -151,27 +151,13 @@
       public InputStream getInputStream()
           throws IOException
       {
  -        try
  -        {
  -            return content.getInputStream();
  -        }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ProtocolException( fse.getMessage() );
  -        }
  +        return content.getInputStream();
       }
   
       public OutputStream getOutputStream()
           throws IOException
       {
  -        try
  -        {
  -            return content.getOutputStream();
  -        }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ProtocolException( fse.getMessage() );
  -        }
  +        return content.getOutputStream();
       }
   
       public int getContentLength()
  
  
  
  1.16      +5 -5      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
  
  Index: AbstractFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractFileObject.java	25 Oct 2002 11:02:44 -0000	1.15
  +++ AbstractFileObject.java	27 Oct 2002 08:16:20 -0000	1.16
  @@ -207,7 +207,7 @@
        * The default is to just throw an exception so filesystems must
        * override it to use it.
        */
  -    protected long doGetLastModifiedTime() throws FileSystemException
  +    protected long doGetLastModifiedTime() throws Exception
       {
           throw new FileSystemException( "vfs.provider/get-last-modified-not-supported.error"
);
       }
  @@ -218,7 +218,7 @@
        * override it to use it.
        */
       protected void doSetLastModifiedTime( long modtime )
  -        throws FileSystemException
  +        throws Exception
       {
           throw new FileSystemException( "vfs.provider/set-last-modified-not-supported.error"
);
       }
  @@ -228,8 +228,8 @@
        * The default implementation just returns null so filesystems must
        * override it to use it.
        */
  -    protected Object doGetAttribute( String attrName )
  -        throws FileSystemException
  +    protected Object doGetAttribute( final String attrName )
  +        throws Exception
       {
           return null;
       }
  @@ -240,7 +240,7 @@
        * override it to use it.
        */
       protected void doSetAttribute( String atttrName, Object value )
  -        throws FileSystemException
  +        throws Exception
       {
           throw new FileSystemException( "vfs.provider/set-attribute-not-supported.error"
);
       }
  
  
  
  1.9       +50 -34    jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultFileContent.java
  
  Index: DefaultFileContent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultFileContent.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultFileContent.java	23 Oct 2002 13:09:10 -0000	1.8
  +++ DefaultFileContent.java	27 Oct 2002 08:16:20 -0000	1.9
  @@ -136,7 +136,14 @@
           {
               throw new FileSystemException( "vfs.provider/get-last-modified-no-exist.error",
file );
           }
  -        return file.doGetLastModifiedTime();
  +        try
  +        {
  +            return file.doGetLastModifiedTime();
  +        }
  +        catch ( final Exception e )
  +        {
  +            throw new FileSystemException( "vfs.provider/get-last-modified.error", file,
e );
  +        }
       }
   
       /**
  @@ -148,23 +155,46 @@
           {
               throw new FileSystemException( "vfs.provider/set-last-modified-no-exist.error",
file );
           }
  -        file.doSetLastModifiedTime( modTime );
  +        try
  +        {
  +            file.doSetLastModifiedTime( modTime );
  +        }
  +        catch ( final Exception e )
  +        {
  +            throw new FileSystemException( "vfs.provider/set-last-modified.error", file,
e );
  +        }
       }
   
       /**
        * Gets the value of an attribute.
        */
  -    public Object getAttribute( String attrName ) throws FileSystemException
  +    public Object getAttribute( final String attrName )
  +        throws FileSystemException
       {
  -        return file.doGetAttribute( attrName );
  +        try
  +        {
  +            return file.doGetAttribute( attrName );
  +        }
  +        catch ( final Exception e )
  +        {
  +            throw new FileSystemException( "vfs.provider/get-attribute.error", new Object[]
{ attrName, file }, e );
  +        }
       }
   
       /**
        * Sets the value of an attribute.
        */
  -    public void setAttribute( String attrName, Object value ) throws FileSystemException
  +    public void setAttribute( final String attrName, final Object value )
  +        throws FileSystemException
       {
  -        file.doSetAttribute( attrName, value );
  +        try
  +        {
  +            file.doSetAttribute( attrName, value );
  +        }
  +        catch ( final Exception e )
  +        {
  +            throw new FileSystemException( "vfs.provider/set-attribute.error", new Object[]
{ attrName, file }, e );
  +        }
       }
   
       /**
  @@ -249,27 +279,13 @@
               // Close the input stream
               if ( instr != null )
               {
  -                try
  -                {
  -                    instr.close();
  -                }
  -                catch ( IOException ioe )
  -                {
  -                    throw new FileSystemException( "vfs.provider/close-instr.error", null,
ioe );
  -                }
  +                instr.close();
               }
   
               // Close the output stream
               if ( outstr != null )
               {
  -                try
  -                {
  -                    outstr.close();
  -                }
  -                catch ( IOException ioe )
  -                {
  -                    throw new FileSystemException( "vfs.provider/close-outstr.error", null,
ioe );
  -                }
  +                outstr.close();
               }
           }
           finally
  @@ -357,7 +373,7 @@
           /**
            * Closes this input stream.
            */
  -        public void close() throws IOException
  +        public void close() throws FileSystemException
           {
               if ( finished )
               {
  @@ -365,14 +381,14 @@
               }
   
               // Close the stream
  -            IOException exc = null;
  +            FileSystemException exc = null;
               try
               {
                   super.close();
               }
  -            catch ( IOException e )
  +            catch ( IOException ioe )
               {
  -                exc = e;
  +                exc = new FileSystemException( "vfs.provider/close-instr.error", file,
ioe );
               }
   
               // Notify the file object
  @@ -380,9 +396,9 @@
               {
                   endInput();
               }
  -            catch ( Exception e )
  +            catch ( final Exception e )
               {
  -                exc = new IOException( e.getMessage() );
  +                exc = new FileSystemException( "vfs.provider/close-instr.error", file,
e );
               }
   
               finished = true;
  @@ -408,18 +424,18 @@
           /**
            * Closes this output stream.
            */
  -        public void close() throws IOException
  +        public void close() throws FileSystemException
           {
  -            IOException exc = null;
  +            FileSystemException exc = null;
   
               // Close the output stream
               try
               {
                   super.close();
               }
  -            catch ( IOException e )
  +            catch ( final IOException e )
               {
  -                exc = e;
  +                exc = new FileSystemException( "vfs.provider/close-outstr.error", file,
e );
               }
   
               // Notify of end of output
  @@ -427,9 +443,9 @@
               {
                   endOutput();
               }
  -            catch ( Exception e )
  +            catch ( final Exception e )
               {
  -                exc = new IOException( e.getMessage() );
  +                exc = new FileSystemException( "vfs.provider/close-outstr.error", file,
e );
               }
   
               if ( exc != null )
  
  
  
  1.4       +2 -16     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLConnection.java
  
  Index: DefaultURLConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultURLConnection.java	23 Oct 2002 11:59:40 -0000	1.3
  +++ DefaultURLConnection.java	27 Oct 2002 08:16:20 -0000	1.4
  @@ -90,27 +90,13 @@
       public InputStream getInputStream()
           throws IOException
       {
  -        try
  -        {
  -            return content.getInputStream();
  -        }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ProtocolException( fse.getMessage() );
  -        }
  +        return content.getInputStream();
       }
   
       public OutputStream getOutputStream()
           throws IOException
       {
  -        try
  -        {
  -            return content.getOutputStream();
  -        }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ProtocolException( fse.getMessage() );
  -        }
  +        return content.getOutputStream();
       }
   
       public int getContentLength()
  
  
  
  1.4       +2 -9      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLStreamHandler.java
  
  Index: DefaultURLStreamHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultURLStreamHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultURLStreamHandler.java	23 Oct 2002 11:59:40 -0000	1.3
  +++ DefaultURLStreamHandler.java	27 Oct 2002 08:16:20 -0000	1.4
  @@ -82,15 +82,8 @@
       protected URLConnection openConnection( final URL url )
           throws IOException
       {
  -        try
  -        {
  -            final FileObject entry = context.resolveFile( url.toExternalForm() );
  -            return new DefaultURLConnection( url, entry.getContent() );
  -        }
  -        catch ( FileSystemException fse )
  -        {
  -            throw new ProtocolException( fse.getMessage() );
  -        }
  +        final FileObject entry = context.resolveFile( url.toExternalForm() );
  +        return new DefaultURLConnection( url, entry.getContent() );
       }
   
       protected void parseURL( final URL u,
  
  
  
  1.9       +10 -3     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Resources.properties	25 Oct 2002 11:07:39 -0000	1.8
  +++ Resources.properties	27 Oct 2002 08:16:20 -0000	1.9
  @@ -7,6 +7,7 @@
   vfs.provider/get-last-modified-not-supported.error=This file type does not support retriving
last modified time.
   vfs.provider/set-last-modified-not-supported.error=This file type does not support setting
last modified time.
   vfs.provider/set-attribute-not-supported.error=This file type does not support setting
attributes.
  +vfs.provider/get-attribute-not-supported.error=This file type does not support getting
attributes.
   vfs.provider/write-not-supported.error=This file type cannot be written to.
   vfs.provider/get-type-no-exist.error=Could not determine the type of file "{0}" because
it does not exist.
   vfs.provider/get-type.error=Could not determine the type of file "{0}".
  @@ -40,21 +41,27 @@
   vfs.provider/read-in-use.error=Could not read file "{0}" because it is already being used.
   vfs.provider/read.error=Could not read file "{0}".
   vfs.provider/get-last-modified-no-exist.error=Could not determine the last modified timestamp
of "{0}" because it does not exist.
  +vfs.provider/get-last-modified.error=Could not determine the last modified timestamp of
"{0}".
   vfs.provider/set-last-modified-no-exist.error=Could not set the last modified timestamp
of "{0}" because it does not exist.
  +vfs.provider/set-last-modified.error=Could not set the last modified timestamp of "{0}".
   vfs.provider/get-certificates-no-exist.error=Could not retrive the certificates of "{0}"
because it does not exist.
  -vfs.provider/close-instr.error=Could not close file input stream.
  -vfs.provider/close-outstr.error=Could not close file output stream.
  +vfs.provider/close-instr.error=Could not close the input stream for file "{0}".
  +vfs.provider/close-outstr.error=Could not close the output stream for file "{0}".
  +vfs.provider/get-attribute.error=Could not get attribute "{0}" of "{1}".
  +vfs.provider/set-attribute.error=Could not set attribute "{0}" of "{1}".
   
   # AbstractFileSystemProvider
   vfs.provider/invalid-absolute-uri.error=Invalid absolute URI "{0}".
   vfs.provider/not-layered-fs.error=File system for URL scheme "{0}" is not a layered file
system.
   
  +# AbstractFileSystem
  +vfs.provider/junctions-not-supported.error=Junctions not supported for file system "{0}".
  +
   # UriParser
   vfs.provider/missing-double-slashes.error=Expecting // to follow the scheme in URI "{0}".
   vfs.provider/missing-hostname.error=Hostname missing from URI "{0}".
   vfs.provider/missing-port.error=Port number is missing from URI "{0}".
   vfs.provider/missing-hostname-path-sep.error=Expecting / to follow the hostname in URI
"{0}".
  -vfs.provider/invalid-childname.error=Invalid file base-name "{0}".
   vfs.provider/invalid-descendent-name.error=Invalid descendent file name "{0}".
   vfs.provider/invalid-escape-sequence.error=Invalid URI escape sequence "{0}".
   vfs.provider/invalid-relative-path.error=Invalid relative file name.
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message