Skip to Main Content

jdk.dio.DeviceDescriptor::getProperties returns null instead of empty String array

Anthony VanelverdingheJun 28 2015 — edited Jul 1 2015

Hi

I think I found a small bug in DeviceDescriptor: its getProperties() method specifies it returns "a String array (a defensive copy) of the device properties or an empty String array if none are defined."

However, when I run the IMlet below, it returns null instead of an empty array & prints "true".

My environment: Raspberry Pi (model B rev 2) with Oracle Java ME Embedded 8.1

Kind regards

Anthony

import java.io.IOException;

import javax.microedition.midlet.MIDlet;

import jdk.dio.DeviceManager;

public class TestGpio extends MIDlet {

   

    @Override

    public void startApp() {

        try {

            String[] properties = DeviceManager.open(24).getDescriptor().getProperties();

            System.out.println(properties == null);

        } catch (IOException e) {

        } finally {

            notifyDestroyed();

        }

    }

   

    @Override

    public void destroyApp(boolean unconditional) {

    }

}

Comments
Post Details
Added on Jun 28 2015
1 comment
703 views