From: <otm...@us...> - 2008-10-21 06:00:40
|
Revision: 5496 http://jython.svn.sourceforge.net/jython/?rev=5496&view=rev Author: otmarhumbel Date: 2008-10-21 06:00:37 +0000 (Tue, 21 Oct 2008) Log Message: ----------- really solve the open file problem Modified Paths: -------------- trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java trunk/installer/test/java/org/python/util/install/StartScriptGeneratorTest.java Modified: trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java =================================================================== --- trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java 2008-10-21 00:47:13 UTC (rev 5495) +++ trunk/installer/src/java/org/python/util/install/StartScriptGenerator.java 2008-10-21 06:00:37 UTC (rev 5496) @@ -189,13 +189,17 @@ file = new File(_targetDirectory, fileName); } FileReader fileReader = new FileReader(file); - StringBuffer sb = new StringBuffer(); - char[] b = new char[8192]; - int n; - while ((n = fileReader.read(b)) > 0) { - sb.append(b, 0, n); + try { + StringBuffer sb = new StringBuffer(); + char[] b = new char[8192]; + int n; + while ((n = fileReader.read(b)) > 0) { + sb.append(b, 0, n); + } + return sb.toString(); + } finally { + fileReader.close(); } - return sb.toString(); } /** Modified: trunk/installer/test/java/org/python/util/install/StartScriptGeneratorTest.java =================================================================== --- trunk/installer/test/java/org/python/util/install/StartScriptGeneratorTest.java 2008-10-21 00:47:13 UTC (rev 5495) +++ trunk/installer/test/java/org/python/util/install/StartScriptGeneratorTest.java 2008-10-21 06:00:37 UTC (rev 5496) @@ -144,10 +144,6 @@ assertTrue(fileNamesSet.contains("jython")); assertTrue(fileNamesSet.contains("jython.bat")); } finally { - try { - // give windows some time to release file locks - Thread.sleep(500); - } catch (InterruptedException e) {} if (dir.exists()) { rmdir(dir); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |