cornucopia: bump SRCREV
[openembedded.git] / recipes / midpath / files / fix-openfile.patch
blobdf677e10118718a30ad1d9946382caa97fd09f92
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
5 @@ -181,10 +181,14 @@
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");
14 + } else {
15 + randomAccessFile = new RandomAccessFile(file, "r");
16 + }
18 - }
19 + }
21 public void openForWrite() throws IOException {
22 if (randomAccessFile == null) {