Brett Walker created GEOS-5047:
----------------------------------
Summary: LockFile implementation doesn't close IO streams.
Key: GEOS-5047
URL: https://jira.codehaus.org/browse/GEOS-5047
Project: GeoServer
Issue Type: Bug
Components: Security
Affects Versions: 2.2-beta1
Environment: Windows XP Professional SP3; Java JDK v1.6.0_22-b04; Maven v3.0.4
Reporter: Brett Walker
Assignee: Andrea Aime
Attachments: LockFile.java.patch
When executing {{mvn clean install}} on the latest {{trunk/src}} it fails. More specifically the maven build fails in the Main module while executing tests. The specific test this bug report is aboout is {{org.geoserver.security.file.FileTest.testLockFile}}.
The IO streams aren't being released by {{org.geoserver.security.file.LockFile}}. In the method {{LockFile.writeLock()}} the {{FileInputStream}} is not being closed; and in the method {{LockFile.writeLockFileContent()}} the {{FileOutputStream}} is not being closed. The upshot of this is when the lock file needs to be deleted, it may not be able to delete the lock file because there is an open stream to it. This causes the test {{FileTest.testLockFile}} to fail.
This effect may be a Java on Windows artifact or because the GC is not able to finalize the open IO stream objects, but this aside the {{LockFile}} code shows poor practise in respect to closing IO streams. When a stream is no longer needed it should be explicitly closed.
I have provided an {{svn patch}} to correct this problem. The existing {{JUnit}} tests are sufficient to test the patch.
This issue may be the source of GEOS-4509 and other issues.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira