changeset 161:a555fd602e89

8085845: UART: emulator crash if UART is closed and GC-ed with unfinished read operation Summary: device state check is moved to generic stopRead. CDE may be rised if device is closed while read() is ongoing Reviewed-by: alkonsta
author snazarki
date Thu, 04 Jun 2015 19:20:15 +0300
parents 481953419516
children 4d3bde06f8db
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Thu Jun 04 17:22:42 2015 +0300
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Thu Jun 04 19:20:15 2015 +0300
@@ -599,6 +599,7 @@
 
     /* stop operation of required type only, e.g. public stopReading() doesn't affect read() */
     private void stopReading(boolean syncVer) throws IOException, UnavailableDeviceException, ClosedDeviceException {
+        checkOpen();
         synchronized(synchReadLock) {
             if (null != inRoundListener && syncVer == (inRoundListener instanceof InternalRoundListener) ) {
                 inRoundListener = null;
@@ -615,7 +616,6 @@
       */
     @Override
     public void stopReading() throws IOException, UnavailableDeviceException, ClosedDeviceException{
-        checkOpen();
         stopReading(false);
     }