changeset 196:b810492e8278

8129340: Exception at event processing thread Summary: Queue.remove() throws NSEE if equeue is empty. Function call was moved after process status verification Reviewed-by: alkonsta
author snazarki
date Fri, 19 Jun 2015 16:38:05 +0300
parents 16b0299dae30
children d56cb669f4f1
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Thu Jun 18 19:04:15 2015 +0300
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Fri Jun 19 16:38:05 2015 +0300
@@ -268,10 +268,11 @@
                         // sync read alsways stops if buffer is full -> no need to resend notification
                         if (!syncRead) {
                             totalBytesRead = 0;
-                            // next time use another buffer
-                            readBuffers.remove();
                             // if not stopped
                             if (inRoundListener != null) {
+                                // next time use another buffer.
+                                // stopRead() cleans readBuffers therefore .read() is moved here
+                                readBuffers.remove();
                                 if (buffer.hasRemaining()) {
                                     readBuffers.add(buffer);
                                 } else {