db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1409254 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/engine/ReadMeFilesTest.java util/PrivilegedFileOpsForTests.java
Date Wed, 14 Nov 2012 16:58:12 GMT
Author: mamta
Date: Wed Nov 14 16:58:11 2012
New Revision: 1409254

URL: http://svn.apache.org/viewvc?rev=1409254&view=rev
Log:
DERBY-5232 (Put a stern README file in log and seg0 directories to warn users of corrpution
they will cause if they touch files there)

Remove redundant file length check on readme files. It is sufficient to check that they exist.
Additionally, assert the value returned by file exists method.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ReadMeFilesTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ReadMeFilesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ReadMeFilesTest.java?rev=1409254&r1=1409253&r2=1409254&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ReadMeFilesTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ReadMeFilesTest.java
Wed Nov 14 16:58:11 2012
@@ -70,8 +70,7 @@ public class ReadMeFilesTest extends Bas
     private void lookForReadmeFile(String path) throws IOException {
         File readmeFile = new File(path,
             DB_README_FILE_NAME);
-        PrivilegedFileOpsForTests.exists(readmeFile);
-        PrivilegedFileOpsForTests.isFileEmpty(readmeFile);
+        assertTrue(readmeFile + "doesn't exist", PrivilegedFileOpsForTests.exists(readmeFile));
     }
 }
  

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java?rev=1409254&r1=1409253&r2=1409254&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
Wed Nov 14 16:58:11 2012
@@ -440,34 +440,6 @@ public class PrivilegedFileOpsForTests {
     }
 
     /**
-     * Checks if the specified file is empty.
-     *
-     * @param f the file
-     * @return true if the file is empty
-     */
-    public static boolean isFileEmpty(final File f) 
-            throws FileNotFoundException {
-        if (f == null) {
-            throw new IllegalArgumentException("file cannot be <null>");
-        }
-        try {
-            return((Boolean)AccessController.doPrivileged (new PrivilegedExceptionAction()
{
-                public Object run() throws IOException {
-                    FileInputStream fis = new FileInputStream(f);
-                    int result = fis.read();
-                    fis.close();
-                    if(result == -1)
-                        return Boolean.valueOf(true);
-                    else
-                        return Boolean.valueOf(false);
-                }
-            })).booleanValue();
-        } catch (PrivilegedActionException pae) {
-            throw (FileNotFoundException)pae.getCause();
-        }
-    }
-
-    /**
      * Obtains information about the specified file.
      *
      * @param f the file



Mime
View raw message