changeset 159:5d161bfcaf7a

8079333: NPE at GPIOPort.close() Summary: Remove reference to GPIOPortConfig.getPins() field. Reviewed-by: alkonsta
author snazarki
date Tue, 05 May 2015 13:56:51 +0300
parents 0bd6096d06e7
children aa7d1593f97f
files src/share/classes/com/oracle/dio/gpio/impl/GPIOPortImpl.java
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/gpio/impl/GPIOPortImpl.java	Thu Apr 30 21:58:05 2015 +0300
+++ b/src/share/classes/com/oracle/dio/gpio/impl/GPIOPortImpl.java	Tue May 05 13:56:51 2015 +0300
@@ -52,6 +52,7 @@
 
     private PortListener listener;
     private int maxVal;
+    private GPIOPinFake[] pins;
 
     public GPIOPortImpl(DeviceDescriptor<GPIOPort> dscr, int mode) throws
                                     DeviceNotFoundException, InvalidDeviceConfigException {
@@ -83,7 +84,7 @@
                                    mode == DeviceManager.EXCLUSIVE);
 
         maxVal = getMaxVal0();
-        GPIOPinFake[] pins  = new GPIOPinFake[pinCfgs.length];
+        pins  = new GPIOPinFake[pinCfgs.length];
         for (int i = 0; i < pins.length; i++) {
             pins[i] = new GPIOPinFake(pinCfgs[i]);
         }
@@ -212,9 +213,8 @@
                 }catch(IOException ex){
                 }
             }
-            GPIOPortConfig cfg = dscr.getConfiguration();
-            for(GPIOPin pin: cfg.getPins()) {
-                ((GPIOPinFake)pin).closeInternal();
+            for(GPIOPinFake pin: pins) {
+               pin.closeInternal();
             }
             // for DM.register: nullifying to remove redundant information from serialized class
             super.close();
@@ -223,7 +223,7 @@
 
     @Override
     public GPIOPin[] getPins() {
-        return null;
+        return pins;
     }
 
     @Local(DontRemoveFields = {