]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
InputStream returns -1 on EOF instead of throwing IOException 24/124/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 14 Oct 2016 13:18:06 +0000 (16:18 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 14 Oct 2016 13:32:38 +0000 (16:32 +0300)
ClusterSupport2.getValueStreamBig now returns -1 when EOF is reached.
Previously it was invalidly throwing IOException (and before that very
invalidly throwing IllegalStateException).

refs #6741

Change-Id: I220e6bd26b94d92ae1db5a330ca3304035e7614e

bundles/org.simantics.acorn/src/org/simantics/acorn/internal/ClusterSupport2.java

index b1b1e8365f22bd8da329284a344639add33093cd..20cd6f462da5865109b4dda0ee25278b1f4633e6 100644 (file)
@@ -258,8 +258,7 @@ public class ClusterSupport2 implements ClusterSupport, IClusterTable {
                @Override
                public int read() throws IOException {
 
-                       if(left <= 0)
-                           throw new IOException("left <= 0 for " + _s);
+                       if(left <= 0) return -1;
 
                        if(offset == _s.bytes.length) {
                                short slen = (short)Math.min(left, IMAX);