You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2016/02/03 21:29:39 UTC

[jira] [Updated] (DERBY-6864) RawDBReaderTest fails on Windows

     [ https://issues.apache.org/jira/browse/DERBY-6864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-6864:
--------------------------------------
    Attachment: d6864.diff

The problem is that RawDBReaderTest.runRecoveryScript() opens a FileReader that reads the recovery.sql script, but it doesn't close it. Windows doesn't allow deletion of open files, so tearDown() fails when trying to clean up the test directory.

Attaching a patch which fixes the problem by opening the FileReader in a try-with-resources statement, which automatically closes the reader when it goes out of scope. The patch also removes the use of LineNumberReader in the method and instead makes it use a plain BufferedReader, since it didn't use any of the extra functionality provided by LineNumberReader.

> RawDBReaderTest fails on Windows
> --------------------------------
>
>                 Key: DERBY-6864
>                 URL: https://issues.apache.org/jira/browse/DERBY-6864
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.13.0.0
>         Environment: Windows 10
> JDK 8u71
> Derby trunk revision 1728254
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d6864.diff
>
>
> RawDBReaderTest fails on Windows with the following output:
> {noformat}
> .<assertDirectoryDeleted> attempt 1 left 2 files/dirs behind: 0=extinout\recovery.sql 1=extinout
> <assertDirectoryDeleted> attempt 2 left 2 files/dirs behind: 0=extinout\recovery.sql 1=extinout
> <assertDirectoryDeleted> attempt 3 left 2 files/dirs behind: 0=extinout\recovery.sql 1=extinout
> <assertDirectoryDeleted> attempt 4 left 2 files/dirs behind: 0=extinout\recovery.sql 1=extinout
> F
> Time: 39,498
> There was 1 failure:
> 1) RawDBReaderTest:embeddedjunit.framework.AssertionFailedError: Failed to delete 2 files (root=C:\cygwin64\tmp\derbytst\extinout): C:\cygwin64\tmp\derbytst\extinout\recovery.sql (isDir=false, canRead=true, canWrite=true, size=801), C:\cygwin64\tmp\derbytst\extinout (isDir=true, canRead=true, canWrite=true, size=0)
>         at org.apache.derbyTesting.junit.BaseTestCase.assertDirectoryDeleted(BaseTestCase.java:1125)
>         at org.apache.derbyTesting.junit.DropDatabaseSetup.removeDirectory(DropDatabaseSetup.java:128)
>         at org.apache.derbyTesting.junit.DropDatabaseSetup.removeDirectory(DropDatabaseSetup.java:118)
>         at org.apache.derbyTesting.junit.SupportFilesSetup.tearDown(SupportFilesSetup.java:130)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:24)
>         at junit.extensions.TestSetup.run(TestSetup.java:27)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)