1 Index: midpath-0.3rc2/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java
2 ===================================================================
3 --- midpath-0.3rc2.orig/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java 2008-05-19 13:56:18.000000000 +0200
4 +++ midpath-0.3rc2/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java 2008-12-17 07:08:54.000000000 +0100
7 public void openForRead() throws IOException {
8 if (randomAccessFile == null) {
9 - //stream = new FileRandomAccessStream(file);
10 - randomAccessFile = new RandomAccessFile(file, "rws");
11 + // Try to get maximum rights to avoid closing the stream if openForWrite is called next
12 + if (file.canWrite()) {
13 + randomAccessFile = new RandomAccessFile(file, "rws");
15 + randomAccessFile = new RandomAccessFile(file, "r");
21 public void openForWrite() throws IOException {
22 if (randomAccessFile == null) {