Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Behaviur Device.getRootDevice()

2004-10-07
2013-05-02
  • Stefano Lenzi
    Stefano Lenzi
    2004-10-07

    Hi Satoshi ,
       I have found that our modification to let <b>Device::gerRootNode()</b> method to work have broken to method <b>Device::isRootDevice()</b>.

    Right now, even with Version 1.5, the method <b>Device::isRootDevice()</b> return always true.

    I solved the problem in this way:
    <pre>
    return getRootNode().getNode("device")
       .getNodeValue(UDN).equals(getUDN());
    </pre>
    instead of old method:
    <pre>
    return (getRootNode() != null) ? true : false;
    </pre>

     
  • Stefano Lenzi
    Stefano Lenzi
    2004-10-07

    Another wat to solve the problem is to use my old solution:

    public Device getRootDevice(){
    Node rootNode = getRootNode();
    if (rootNode == null)
    rootNode = getDeviceNode().getRootNode();
    if( rootNode == null)
    return null;
    Node devNode = rootNode.getNode(Device.ELEM_NAME);
    if (devNode == null)
    return null;
    return new Device(rootNode, devNode);
    }