db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1523334 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/io/ engine/org/apache/derby/io/ testing/org/apache/derbyTesting/functionTests/util/corruptio/
Date Sat, 14 Sep 2013 21:44:54 GMT
Author: bpendleton
Date: Sat Sep 14 21:44:54 2013
New Revision: 1523334

URL: http://svn.apache.org/r1523334
Log:
DERBY-6315: Improve test coverage of org.apache.derby.impl.io.InputStreamFile

This patch was contributed by Ahsan Shamsudeen (ahsan dot competition at gmail dot com)

This patch removes the unused method StorageFile.length().

The length method is removed from the StorageFile interface, as well as
from the InputStreamFile, JarDBFile, and CorruptFile implementations.

The method was not called anywhere, and removing it simplifies this area
of the Derby code.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/io/InputStreamFile.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/io/JarDBFile.java
    db/derby/code/trunk/java/engine/org/apache/derby/io/StorageFile.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptFile.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/InputStreamFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/InputStreamFile.java?rev=1523334&r1=1523333&r2=1523334&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/InputStreamFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/InputStreamFile.java Sat Sep
14 21:44:54 2013
@@ -269,27 +269,6 @@ abstract class InputStreamFile implement
     }
 
     /**
-     * Returns the length of the named file if it is not a directory. The return value is
not specified
-     * if the file is a directory.
-     *
-     * @return The length, in bytes, of the named file if it exists and is not a directory,
-     *         0 if the file does not exist, or any value if the named file is a directory.
-     */
-    public long length()
-    {
-        try
-        {
-            InputStream is = getInputStream();
-            if( is == null)
-                return 0;
-            long len = is.available();
-            is.close();
-            return len;
-        }
-        catch( IOException e){ return 0;}
-    } // end of length
-
-    /**
      * Get the name of the parent directory if this name includes a parent.
      *
      * @return An StorageFile denoting the parent directory of this StorageFile, if it has
a parent, null if

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/io/JarDBFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/io/JarDBFile.java?rev=1523334&r1=1523333&r2=1523334&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/io/JarDBFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/io/JarDBFile.java Sat Sep 14 21:44:54
2013
@@ -86,21 +86,6 @@ class JarDBFile extends InputStreamFile
     }
 
     /**
-     * Returns the length of the named file if it is not a directory. The return value is
not specified
-     * if the file is a directory.
-     *
-     * @return The length, in bytes, of the named file if it exists and is not a directory,
-     *         0 if the file does not exist, or any value if the named file is a directory.
-     */
-    public long length()
-    {
-        ZipEntry entry = getEntry();
-        if( entry == null)
-            return 0;
-        return entry.getSize();
-    } // end of length
-
-    /**
      * Get the name of the parent directory if this name includes a parent.
      *
      * @return An StorageFile denoting the parent directory of this StorageFile, if it has
a parent, null if

Modified: db/derby/code/trunk/java/engine/org/apache/derby/io/StorageFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/io/StorageFile.java?rev=1523334&r1=1523333&r2=1523334&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/io/StorageFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/io/StorageFile.java Sat Sep 14 21:44:54
2013
@@ -183,15 +183,6 @@ public interface StorageFile
     public boolean mkdirs();
 
     /**
-     * Returns the length of the named file if it is not a directory. The return value is
not specified
-     * if the file is a directory.
-     *
-     * @return The length, in bytes, of the named file if it exists and is not a directory,
-     *         0 if the file does not exist, or any value if the named file is a directory.
-     */
-    public long length();
-
-    /**
      * Get the name of the parent directory if this name includes a parent.
      *
      * @return An StorageFile denoting the parent directory of this StorageFile, if it has
a parent, null if

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptFile.java?rev=1523334&r1=1523333&r2=1523334&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptFile.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/corruptio/CorruptFile.java
Sat Sep 14 21:44:54 2013
@@ -223,19 +223,6 @@ class CorruptFile implements StorageFile
 	}
 
 
-    /**
-     * Returns the length of the named file if it is not a directory. 
-     *
-     * The return value is not specified if the file is a directory.
-     *
-     * @return The length, in bytes, of the named file if it exists and is not 
-     *         a directory, 0 if the file does not exist, or any value if the 
-     *         named file is a directory.
-     */
-    public long length()
-	{
-		return realFile.length();
-	}
 
     /**
      * Make the named file or directory read-only. 



Mime
View raw message