< prev index next >

src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java

Print this page

        

@@ -938,19 +938,18 @@
         if (position + size < 0)
             throw new IllegalArgumentException("Position + size overflow");
         if (size > Integer.MAX_VALUE)
             throw new IllegalArgumentException("Size exceeds Integer.MAX_VALUE");
 
-        int imode;
+        int imode = -1;
         if (mode == MapMode.READ_ONLY)
             imode = MAP_RO;
         else if (mode == MapMode.READ_WRITE)
             imode = MAP_RW;
         else if (mode == MapMode.PRIVATE)
             imode = MAP_PV;
-        else
-            throw new UnsupportedOperationException();
+        assert (imode >= 0);
         if ((mode != MapMode.READ_ONLY) && !writable)
             throw new NonWritableChannelException();
         if (!readable)
             throw new NonReadableChannelException();
 
< prev index next >