comparison src/org/tmatesoft/hg/repo/HgRepositoryLock.java @ 619:868b2ffdcd5c

Close FIS, not FileChannel, to clear both references to FileDescriptor right away
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 17 May 2013 22:04:23 +0200
parents f41dd9a3b8af
children 5afc7eedb3dd
comparison
equal deleted inserted replaced
618:7c0d2ce340b8 619:868b2ffdcd5c
189 fos.write(content); 189 fos.write(content);
190 fos.close(); 190 fos.close();
191 } 191 }
192 192
193 private static byte[] read(File f) throws IOException { 193 private static byte[] read(File f) throws IOException {
194 FileChannel fc = new FileInputStream(f).getChannel(); 194 FileInputStream fis = new FileInputStream(f);
195 FileChannel fc = fis.getChannel();
195 ByteBuffer bb = ByteBuffer.allocate(Internals.ltoi(fc.size())); 196 ByteBuffer bb = ByteBuffer.allocate(Internals.ltoi(fc.size()));
196 fc.read(bb); 197 fc.read(bb);
197 fc.close(); 198 fis.close();
198 return bb.array(); 199 return bb.array();
199 } 200 }
200 } 201 }