Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139267

An attempt to register application-provided DeviceProvider causes a NPE from jdk.dio.DeviceManager.register()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: embedded
    • Labels:
    • Subcomponent:
      dio
    • CPU:
      generic
    • OS:
      generic

      Description

      Tried on b239/rpi with DIO VTS 1.1
      ============================

      Test case code looks in the following way:

        public Status testCustomDeviceProviderOpen1() {
              try {
                  Device ret = null;

                  // Name doesn't match
                  int id = syncRegister(DeviceManager.UNSPECIFIED_ID,
                          new TestDeviceConfig(new byte[]{3, 2, 1, 4, 5}), "TestDevice1", "hello=world");

                  if (id == -2) {
                      return Status.failed("Failed to register a TestDevice");
                  }

                  try {

                      ret = DeviceManager.open("TestDevice", TestDevice.class, DeviceManager.EXCLUSIVE, "hello=world");

                      log.println("Opened: " + ret);
                      if (ret != null) {
                          log.println("Ret type: " + ret.getClass().getName());
                          return Status.failed("Unexpectedly found TestDevice which is not registered. " +
                                  "Registry cleanup is probably needed.");
                      } else {
                          return Status.failed("DeviceManager.open(\"TestDevice\", TestDevice.class, DeviceManager.EXCLUSIVE, \"hello=world\") returns null");
                      }
                  } catch (DeviceNotFoundException expected) {
                  } catch (UnsupportedDeviceTypeException unexpected) {
                      return Status.failed("TestDevice.class is unexpectedly not supported");
                  } catch (IOException e) {
                      return Status.failed("Unable open custom device");
                  } finally {
                      if (ret != null) try {
                          ret.close();
                      } catch (IOException e) {
                          return Status.failed("Error closing device");
                      }


                      if (id != -2 && !syncUnRegister(id)) {
                          return Status.failed("Failed to unregister a TestDevice");
                      }
                  }

                  return Status.passed("OKAY");
              } catch (Throwable t) {
                  t.printStackTrace(log);
                  return Status.failed("Unexpected Throwable: "+t);
              }
          }

      ==================
      Test log is:

      java.lang.NullPointerException: intf is null
      at jdk.dio.DeviceManager.open(DeviceManager.java:730)
      at jdk.dio.DeviceManager.open(DeviceManager.java:827)
      at com.oracle.dio.registry.Registry$1.run(Registry.java:164)
      at com.oracle.dio.registry.Registry$1.run(Registry.java:134)
      at com.oracle.dio.utils.PrivilegeController$1.run(PrivilegeController.java:44)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.oracle.dio.utils.PrivilegeController.doPrivileged(PrivilegeController.java:40)
      at com.oracle.dio.registry.Registry.checkConfig(Registry.java:134)
      at com.oracle.dio.registry.Registry.register(Registry.java:126)
      at com.oracle.dio.registry.RegistryImpl.register(RegistryImpl.java:81)
      at jdk.dio.DeviceManager.register(DeviceManager.java:929)
      at com.oracle.tests.jdk.dio.spi.positive.SPIOpenTests.syncRegister(Unknown Source)
      at com.oracle.tests.jdk.dio.spi.positive.SPIOpenTests.testCustomDeviceProviderOpen1(Unknown Source)
      at com.oracle.tests.jdk.dio.spi.positive.SPIOpenTests.runTestCases(Unknown Source)
      at com.sun.tck.cldc.lib.MultiTest.run(MultiTest.java:150)
      at com.sun.tck.cdc.lib.ExecCLDCTestOnCDCSameJVMCmd.executeCLDCTest(ExecCLDCTestOnCDCSameJVMCmd.java:261)
      at com.sun.tck.cdc.lib.ExecCLDCTestOnCDCSameJVMCmd.run(ExecCLDCTestOnCDCSameJVMCmd.java:196)
      at com.sun.tck.j2me.agent.J2SEPlatformAdapter.execute(J2SEPlatformAdapter.java:97)
      at com.sun.tck.j2me.execution.baseclient.BaseAgent.executeRequests(BaseAgent.java:242)
      at com.sun.tck.j2me.execution.client.Agent.access$000(Agent.java:62)
      at com.sun.tck.j2me.execution.client.Agent$Executor.run(Agent.java:108)
      testCustomDeviceProviderOpen1: Failed. Unexpected Throwable: java.lang.NullPointerException: intf is null


        Attachments

          Activity

            People

            Assignee:
            bkvartsk Boris Kvartskhava
            Reporter:
            bkvartsk Boris Kvartskhava
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: