Commit in lcio/src/java/hep/lcio/implementation/sio on MAIN
SIOLCRandomAccessReader.java+12-101.2 -> 1.3
Dont leave the file in an undefined state after trying but failing to read the final LCIORandomAccess record

lcio/src/java/hep/lcio/implementation/sio
SIOLCRandomAccessReader.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SIOLCRandomAccessReader.java	22 Jun 2010 13:49:56 -0000	1.2
+++ SIOLCRandomAccessReader.java	30 Jun 2010 00:10:48 -0000	1.3
@@ -26,17 +26,19 @@
     public void open(String filename) throws IOException {
         super.open(filename);
         // Peek at the last record to see if this file supports random access
-        try {
-            //FIXME: Should not hardwire record length
-            SIORecord record = reader.readRecord( - RandomAccessBlock.LCRANDOMACCESSRECORDSIZE );
-            if ("LCIORandomAccess".equals(record.getRecordName())) {
-                randomAccess = new FileRandomAccessSupport(reader, record);
-            }
-            reader.seek(0);
-        } catch (IOException x) {
-            // OK, just assume random access is not supported
+        if (reader.isRandomAccess()) {
+            try {
+                //FIXME: Should not hardwire record length
+                SIORecord record = reader.readRecord( - RandomAccessBlock.LCRANDOMACCESSRECORDSIZE );
+                if ("LCIORandomAccess".equals(record.getRecordName())) {
+                    randomAccess = new FileRandomAccessSupport(reader, record);
+                }
+            } catch (IOException x) {
+                // OK, just assume random access is not supported
+            } finally {
+                reader.seek(0);
+            }
         }
-
     }
 
     @Override
CVSspam 0.2.8