Remove check on available(). Could lead to premature exit of reading.
authorDennis Schafroth <dennis@indexdata.com>
Wed, 27 Jun 2012 09:21:53 +0000 (11:21 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 27 Jun 2012 09:21:53 +0000 (11:21 +0200)
src/org/marc4j/MarcStreamReader.java

index 3abfc1e..99ad0c3 100644 (file)
@@ -109,19 +109,14 @@ public class MarcStreamReader implements MarcReader {
      * Returns true if the iteration has more records, false otherwise.\r
      */\r
     public boolean hasNext() {\r
-      int available;\r
       try {\r
-          available = input.available();\r
           try {\r
             leaderBuffer = new byte[24];\r
             input.readFully(leaderBuffer);\r
           } catch (EOFException eof) {\r
             // If we are not capable of reading the leader before EOF, we cannot read a record\r
-            // This happens when we read gzipped marc files, that it returns available bytes, but none is present\r
-            available = 0;\r
+            return false;\r
           }\r
-            if (available == 0)\r
-                return false;\r
         } catch (IOException e) {\r
             throw new MarcException(e.getMessage(), e);\r
         }\r