changeset 116:9fa998722ab8

8075050: SPICompositeMessage.appendDelay failure Summary: message status is checked. Reviewed-by: alkonsta
author snazarki
date Thu, 12 Mar 2015 14:01:13 +0300
parents c9392253b499
children e91c5536f398
files src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java	Tue Mar 10 13:42:29 2015 +0400
+++ b/src/share/classes/com/oracle/dio/spibus/impl/SPICompositeMessageImpl.java	Thu Mar 12 14:01:13 2015 +0300
@@ -59,13 +59,17 @@
         }
     }
 
-    void check(Message message) throws ClosedDeviceException {
-
+    private void checkStatus() {
         if (isAlreadyTransferedOnce) {
             throw new IllegalStateException(
                 ExceptionMessage.format(ExceptionMessage.I2CBUS_ALREADY_TRANSFERRED_MESSAGE)
             );
         }
+    }
+
+    private void check(Message message) throws ClosedDeviceException {
+
+        checkStatus();
 
         if (0 > message.skip) {
             throw new IllegalArgumentException(
@@ -137,6 +141,9 @@
 
     @Override
     public synchronized SPICompositeMessage appendDelay(int delay) {
+
+        checkStatus();
+
         this.delay = delay;
         return this;
     }