changeset 176:3e30ad0fc940

8081697: Runtime crash on some DIO VTS UART tests Summary: Added device check prior to some function execution Reviewed-by: alkonsta
author snazarki
date Tue, 02 Jun 2015 18:05:59 +0300
parents cd8f6c7683c5
children 28f536a049ec
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Tue Jun 02 17:03:19 2015 +0300
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Tue Jun 02 18:05:59 2015 +0300
@@ -481,8 +481,6 @@
      */
     @Override
     public void startWriting(ByteBuffer src, OutputRoundListener<UART, ByteBuffer> listener) throws IOException, UnavailableDeviceException, ClosedDeviceException{
-        checkPowerState();
-
         if(src == null || listener == null){
             throw new NullPointerException(
                 ExceptionMessage.format(ExceptionMessage.UART_NULL_SRC_OR_LISTENER)
@@ -510,6 +508,7 @@
 
     private void writeAsync(ByteBuffer src1, ByteBuffer src2, OutputRoundListener<UART, ByteBuffer> listener) throws IOException,
         UnavailableDeviceException, ClosedDeviceException {
+        checkPowerState();
         synchronized(synchWriteLock) {
             checkWrite();
             writeBuffers[0] = src1;
@@ -549,8 +548,6 @@
      */
     @Override
     public void startReading(ByteBuffer src, InputRoundListener<UART, ByteBuffer> listener) throws IOException, UnavailableDeviceException, ClosedDeviceException{
-        checkPowerState();
-
         if(src == null || listener == null){
             throw new NullPointerException(
                 ExceptionMessage.format(ExceptionMessage.UART_NULL_SRC_OR_LISTENER)
@@ -576,6 +573,7 @@
 
     private void readAsync(ByteBuffer src1, ByteBuffer src2, InputRoundListener<UART, ByteBuffer> listener)  throws IOException,
             UnavailableDeviceException, ClosedDeviceException {
+        checkPowerState();
         synchronized(synchReadLock){
             checkRead();
             inRoundListener = listener;