changeset 228:419a9dee7d0f

MERT-10176: NPE is not thrown at I2CCombinedMessage.appendXTest Summary: Added NULL check Reviewed-by: alkonsta
author snazarki
date Thu, 20 Aug 2015 19:34:57 +0300
parents 1eeb2952871d
children 8afb91f7282c
files src/share/classes/com/oracle/dio/i2cbus/impl/I2CCombinedMessage.java src/share/classes/jdk/dio/counter/CounterPermission.java
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/i2cbus/impl/I2CCombinedMessage.java	Thu Aug 20 19:08:03 2015 +0300
+++ b/src/share/classes/com/oracle/dio/i2cbus/impl/I2CCombinedMessage.java	Thu Aug 20 19:34:57 2015 +0300
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Objects;
 
 import com.oracle.dio.utils.ExceptionMessage;
 import com.oracle.dio.utils.Logging;
@@ -65,6 +66,9 @@
             );
         }
 
+        // null check
+        message.buf.capacity();
+
         if (0 > message.skip) {
             throw new IllegalArgumentException(
                 ExceptionMessage.format(ExceptionMessage.I2CBUS_NEGATIVE_SKIP_ARG)
--- a/src/share/classes/jdk/dio/counter/CounterPermission.java	Thu Aug 20 19:08:03 2015 +0300
+++ b/src/share/classes/jdk/dio/counter/CounterPermission.java	Thu Aug 20 19:34:57 2015 +0300
@@ -74,7 +74,6 @@
      */
     public CounterPermission(String name) {
         super(name);
-        myActions = OPEN;
         Utils.checkDevicePermissionChannelFormat(name, Utils.DECIMAL_DIGITS);
     }