midpath-core 0.2+0.3rc2: Updated fix-openfile patch to what was committed upstream.
authorRobert Schuster <thebohemian@gmx.net>
Fri, 5 Dec 2008 11:30:31 +0000 (12:30 +0100)
committerRobert Schuster <thebohemian@gmx.net>
Fri, 5 Dec 2008 11:30:31 +0000 (12:30 +0100)
packages/midpath/files/fix-openfile.patch
packages/midpath/midpath-core_0.2+0.3rc2.bb

index 6b9b8be..392364b 100644 (file)
@@ -1,13 +1,22 @@
 Index: midpath-0.3rc2/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java
 ===================================================================
 --- midpath-0.3rc2.orig/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java  2008-12-04 21:10:39.000000000 +0100
-+++ midpath-0.3rc2/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java       2008-12-04 21:12:11.000000000 +0100
-@@ -182,7 +182,7 @@
++++ midpath-0.3rc2/components/core/src/org/thenesis/midpath/io/backend/j2se/FileHandlerImpl.java       2008-12-05 12:29:47.000000000 +0100
+@@ -181,10 +181,13 @@
\r
        public void openForRead() throws IOException {\r
                if (randomAccessFile == null) {\r
-                       //stream = new FileRandomAccessStream(file);\r
+-                      //stream = new FileRandomAccessStream(file);\r
 -                      randomAccessFile = new RandomAccessFile(file, "rws");\r
-+                      randomAccessFile = new RandomAccessFile(file, "r");\r
-               }\r
-       }\r
+-              }\r
+-      }\r
++                      // Try to get maximum rights to avoid closing the stream if openForWrite is called next\r
++                      if (file.canWrite()) {\r
++                              randomAccessFile = new RandomAccessFile(file, "rws");\r
++                      } else {\r
++                              randomAccessFile = new RandomAccessFile(file, "r");\r
++                      }\r
++  }\r
  \r
+       public void openForWrite() throws IOException {\r
+               if (randomAccessFile == null) {\r
index d4d6b6b..ec3291c 100644 (file)
@@ -1,6 +1,6 @@
 DESCRIPTION = "MIDPath is a Java library which provides a MIDP2 implementation"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/midpath/midpath-0.3rc2.tar.gz"