changeset 152:33c00f148c64

8077038: Some SPICompositeMessage tests fail due wrong value of array is returned Summary: appendDelay can throw ClosedDeviceException now Reviewed-by: alkonsta
author snazarki
date Mon, 06 Apr 2015 21:51:04 +0400
parents a6f18afacb4c
children a9ea3a23598b
files src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java	Mon Apr 06 21:38:05 2015 +0400
+++ b/src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java	Mon Apr 06 21:51:04 2015 +0400
@@ -59,12 +59,15 @@
         }
     }
 
-    private void checkStatus() {
+    private void checkStatus() throws ClosedDeviceException {
         if (isAlreadyTransferedOnce) {
             throw new IllegalStateException(
                 ExceptionMessage.format(ExceptionMessage.I2CBUS_ALREADY_TRANSFERRED_MESSAGE)
             );
         }
+        if (!device.isOpen()) {
+            throw new ClosedDeviceException();
+        }
     }
 
     private void check(Message message) throws ClosedDeviceException {
@@ -77,10 +80,6 @@
             );
         }
 
-        if (!device.isOpen()) {
-            throw new ClosedDeviceException();
-        }
-
         for (int i = 0; i < messageList.size(); i++) {
             ByteBuffer tx = messageList.get(i).tx;
             ByteBuffer rx = messageList.get(i).rx;
@@ -140,7 +139,7 @@
     }
 
     @Override
-    public synchronized SPICompositeMessage appendDelay(int delay) {
+    public synchronized SPICompositeMessage appendDelay(int delay) throws ClosedDeviceException {
 
         checkStatus();