changeset 37:25e9ab48c287

8056176: Expected IOE or NO UnsupportedOperationException is not thrown when setting UART Baud Rate to unsupported value Reviewed-by: raimandi Contributed-by: alexey.karaksin@oracle.com
author alkonsta
date Thu, 28 Aug 2014 18:52:15 +0400
parents 44692fd6565d
children 510e625c9bcf
files src/se/native/com/oracle/dio/uart/impl/jni_uart.cpp src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/se/native/com/oracle/dio/uart/impl/jni_uart.cpp	Wed Aug 27 10:14:17 2014 -0400
+++ b/src/se/native/com/oracle/dio/uart/impl/jni_uart.cpp	Thu Aug 28 18:52:15 2014 +0400
@@ -403,7 +403,7 @@
   (JNIEnv* env, jobject obj, jint baudRate) {
     device_reference device = getDeviceReferenceFromDeviceObject(env, obj);
     if (JAVACALL_FAIL == javacall_serial_set_baudRate(getDeviceHandle(device), baudRate)) {
-        checkJavacallFailure(env, JAVACALL_DIO_FAIL);
+        checkJavacallFailure(env, JAVACALL_DIO_UNSUPPORTED_OPERATION);
     }
 }
 
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Wed Aug 27 10:14:17 2014 -0400
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Thu Aug 28 18:52:15 2014 +0400
@@ -403,6 +403,9 @@
     @Override
     public synchronized void setBaudRate(int baudRate) throws IOException, UnavailableDeviceException, ClosedDeviceException{
         checkPowerState();
+        if(baudRate <= 0){
+            throw new java.lang.UnsupportedOperationException();
+        }
         setBaudRate0( baudRate);
     }