changeset 175:cd8f6c7683c5

8081503: Some RoundCompletionEvent test cases faildue to missed IAE Summary: Added required checks Reviewed-by: snazarki Contributed-by: olga.milovskaya@oracle.com
author snazarki
date Tue, 02 Jun 2015 17:03:19 +0300
parents feda4d56c9a5
children 3e30ad0fc940
files src/share/classes/jdk/dio/RoundCompletionEvent.java
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/jdk/dio/RoundCompletionEvent.java	Fri May 29 18:17:34 2015 +0300
+++ b/src/share/classes/jdk/dio/RoundCompletionEvent.java	Tue Jun 02 17:03:19 2015 +0300
@@ -100,7 +100,7 @@
             throw new NullPointerException();
         }
 
-        if (number < 0 || number > buffer.limit() || timeStamp < 0 || timeStampMicros < 0) {
+        if (number < 0 || timeStamp < 0 || timeStampMicros < 0) {
             throw new IllegalArgumentException();
         }
         this.device = device;
@@ -108,6 +108,7 @@
         this.number = number;
         this.timeStamp = timeStamp;
         this.timeStampMicros = timeStampMicros;
+        this.count = 1;
     }
 
     /**
@@ -152,12 +153,8 @@
      *             if {@code timeStamp}, {@code timeStampMicros} or {@code number} is negative.
      */
     public RoundCompletionEvent(P device, B buffer, int number, boolean onError, long timeStamp, int timeStampMicros) {
-        this.device = device;
-        this.buffer = buffer;
-        this.number = number;
+        this(device, buffer, number, timeStamp, timeStampMicros);
         this.onError = onError;
-        this.timeStamp = timeStamp;
-        this.timeStampMicros = timeStampMicros;
     }
 
     /**