src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
changeset 54532 e9c62d960d64
parent 53324 cbb8341a127a
child 57804 9b7b9f16dfd9
--- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Mon Apr 15 15:38:47 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Apr 09 16:21:20 2019 +0100
@@ -940,14 +940,15 @@
         if (size > Integer.MAX_VALUE)
             throw new IllegalArgumentException("Size exceeds Integer.MAX_VALUE");
 
-        int imode = -1;
+        int imode;
         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;
-        assert (imode >= 0);
+        else
+            throw new UnsupportedOperationException();
         if ((mode != MapMode.READ_ONLY) && !writable)
             throw new NonWritableChannelException();
         if (!readable)