changeset 34:93cb5cb04f26

8056057: NPE to throw by PulseCounterConfig when controllerName is null Reviewed-by: raimandi Contributed-by: alexey.mironov@oracle.com
author alkonsta
date Tue, 26 Aug 2014 19:32:35 +0400
parents a60958f44b0c
children 28468c289784
files src/share/classes/jdk/dio/counter/PulseCounterConfig.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/jdk/dio/counter/PulseCounterConfig.java	Tue Aug 26 19:21:36 2014 +0400
+++ b/src/share/classes/jdk/dio/counter/PulseCounterConfig.java	Tue Aug 26 19:32:35 2014 +0400
@@ -189,6 +189,8 @@
      *             </ul>
      */
     public PulseCounterConfig(String controllerName, int channelNumber, int type) {
+        // checks for null
+        controllerName.length();
         this.controllerName = controllerName;
         this.channelNumber = channelNumber;
         this.type = type;
@@ -223,7 +225,7 @@
      *             if {@code controllerName} or {@code source} is {@code null}.
      */
     public PulseCounterConfig(String controllerName, int channelNumber, int type, GPIOPinConfig source) {
-        // checsk for null
+        // checks for null
         controllerName.length();
         this.controllerName = controllerName;
         this.channelNumber = channelNumber;
@@ -356,7 +358,7 @@
     }
 
     private void checkValues() throws IllegalArgumentException {
-        if (null == controllerName && controllerNumber < DEFAULT) {
+        if (controllerNumber < DEFAULT) {
             throw new IllegalArgumentException(
                 ExceptionMessage.format(ExceptionMessage.COUNTER_INVALID_CONTROLLER_NUMBER)
             );