changeset 183:da7936b5c7b6

8129848: DeviceEvent subclasses constructors wouldn't throw IAE if timeStampMicros >999 Summary: Check timeStampMicros > 999 is added Reviewed-by: snazarki Contributed-by: olga.milovskaya@oracle.com
author snazarki
date Thu, 25 Jun 2015 15:09:14 +0300
parents 5accb238f20b
children 061aaa895a57
files src/share/classes/jdk/dio/RoundCompletionEvent.java src/share/classes/jdk/dio/adc/MonitoringEvent.java src/share/classes/jdk/dio/counter/CountingEvent.java src/share/classes/jdk/dio/generic/GenericEvent.java src/share/classes/jdk/dio/gpio/PinEvent.java src/share/classes/jdk/dio/gpio/PortEvent.java src/share/classes/jdk/dio/modem/ModemSignalEvent.java src/share/classes/jdk/dio/pwm/GenerationEvent.java src/share/classes/jdk/dio/uart/UARTEvent.java
diffstat 9 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/jdk/dio/RoundCompletionEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/RoundCompletionEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -100,7 +100,7 @@
             throw new NullPointerException();
         }
 
-        if (number < 0 || timeStamp < 0 || timeStampMicros < 0) {
+        if (number < 0 || timeStamp < 0 || timeStampMicros < 0 || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
         this.device = device;
--- a/src/share/classes/jdk/dio/adc/MonitoringEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/adc/MonitoringEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -104,7 +104,7 @@
             throw new NullPointerException();
         }
 
-        if ((type != BACK_TO_RANGE && type != OUT_OF_RANGE) || timeStamp < 0 || timeStampMicros < 0) {
+        if ((type != BACK_TO_RANGE && type != OUT_OF_RANGE) || timeStamp < 0 || timeStampMicros < 0 || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
         this.device = channel;
--- a/src/share/classes/jdk/dio/counter/CountingEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/counter/CountingEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -125,7 +125,8 @@
             0 > value ||
             0 > interval ||
             0 > timeStamp ||
-            0 > timeStampMicros) {
+            0 > timeStampMicros ||
+            timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
     }
--- a/src/share/classes/jdk/dio/generic/GenericEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/generic/GenericEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -101,7 +101,7 @@
         this.timeStamp = timeStamp;
         this.timeStampMicros = timeStampMicros;
         this.count = 1;
-        if (id < 0 || timeStamp < 0 || timeStampMicros < 0) {
+        if (id < 0 || timeStamp < 0 || timeStampMicros < 0 || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
     }
--- a/src/share/classes/jdk/dio/gpio/PinEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/gpio/PinEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -76,7 +76,7 @@
     public PinEvent(GPIOPin pin, boolean value, long timeStamp, int timeStampMicros) {
         // checks for null
         pin.isOpen();
-        if (0 > timeStamp || 0 > timeStampMicros) {
+        if (0 > timeStamp || 0 > timeStampMicros || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
         this.device = pin;
--- a/src/share/classes/jdk/dio/gpio/PortEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/gpio/PortEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -76,7 +76,7 @@
     public PortEvent(GPIOPort port, int value, long timeStamp, int timeStampMicros) {
         // checks for null
         port.isOpen();
-        if (0 > timeStamp || 0 > timeStampMicros) {
+        if (0 > timeStamp || 0 > timeStampMicros || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
         this.device = port;
--- a/src/share/classes/jdk/dio/modem/ModemSignalEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/modem/ModemSignalEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -104,7 +104,7 @@
         final int mask = (ModemSignalsControl.DCD_SIGNAL | ModemSignalsControl.DSR_SIGNAL |
                           ModemSignalsControl.RI_SIGNAL   | ModemSignalsControl.CTS_SIGNAL);
         if (signalID == 0 || (~mask & signalID) != 0 ||
-            0 > timeStamp || 0 > timeStampMicros) {
+            0 > timeStamp || 0 > timeStampMicros || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
     }
--- a/src/share/classes/jdk/dio/pwm/GenerationEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/pwm/GenerationEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -81,7 +81,7 @@
             throw new NullPointerException();
         }
 
-        if (count < 0 || timeStamp < 0 || timeStampMicros < 0) {
+        if (count < 0 || timeStamp < 0 || timeStampMicros < 0 || timeStampMicros > 999) {
             throw new IllegalArgumentException();
         }
 
--- a/src/share/classes/jdk/dio/uart/UARTEvent.java	Thu Jun 25 13:53:50 2015 +0300
+++ b/src/share/classes/jdk/dio/uart/UARTEvent.java	Thu Jun 25 15:09:14 2015 +0300
@@ -105,7 +105,7 @@
             throw new IllegalArgumentException();
         }
 
-        if(timeStamp < 0 || timeStampMicros < 0){
+        if(timeStamp < 0 || timeStampMicros < 0 || timeStampMicros > 999){
             throw new IllegalArgumentException();
         }