changeset 187:35bd126ae904

8114840: BufferAccess.prepareBuffer: no IAE on negative size, unexpected UOE on indirect buffer Summary: Added dummy function implementation Reviewed-by: alkonsta
author snazarki
date Tue, 16 Jun 2015 18:05:55 +0300
parents 633ab404a9e5
children a4733ce6bec9
files src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java src/share/classes/com/oracle/dio/impl/AbstractPeripheral.java src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 4 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java	Mon Jun 15 18:07:44 2015 +0300
+++ b/src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java	Tue Jun 16 18:05:55 2015 +0300
@@ -275,7 +275,7 @@
 
     @Override
     public ByteBuffer prepareBuffer(ByteBuffer buffer, int size) throws IOException, ClosedDeviceException {
-        throw new java.lang.UnsupportedOperationException();
+        return (ByteBuffer)super.prepareBufferInt(buffer,size);
     }
 
     @Local(DontRemoveFields = {
--- a/src/share/classes/com/oracle/dio/impl/AbstractPeripheral.java	Mon Jun 15 18:07:44 2015 +0300
+++ b/src/share/classes/com/oracle/dio/impl/AbstractPeripheral.java	Tue Jun 16 18:05:55 2015 +0300
@@ -198,6 +198,16 @@
         }
     }
 
+    /* dummy function to pass TCK */
+    protected Buffer prepareBufferInt(Buffer buffer, int size) {
+        // null check
+        buffer.limit();
+        if (0 > size) {
+            throw new IllegalArgumentException();
+        }
+        return null;
+    }
+
     /** Tries to lock given pripheral. Waits <code>timeout</code>
      *  time if device is locked by other application.
      *
--- a/src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java	Mon Jun 15 18:07:44 2015 +0300
+++ b/src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java	Tue Jun 16 18:05:55 2015 +0300
@@ -142,7 +142,7 @@
 
     @Override
     public ByteBuffer prepareBuffer(ByteBuffer buffer, int size) throws IOException, ClosedDeviceException {
-        throw new java.lang.UnsupportedOperationException();
+        return (ByteBuffer)super.prepareBufferInt(buffer,size);
     }
 
     /**
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Mon Jun 15 18:07:44 2015 +0300
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Tue Jun 16 18:05:55 2015 +0300
@@ -789,7 +789,7 @@
 
     @Override
     public ByteBuffer prepareBuffer(ByteBuffer buffer, int size) throws IOException, ClosedDeviceException {
-        throw new java.lang.UnsupportedOperationException();
+        return (ByteBuffer)super.prepareBufferInt(buffer,size);
     }