XBean
  1. XBean
  2. XBEAN-119

ContextUtil$ReadOnlyBinding#isRelative() always returns false

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3, 3.4, 3.4.1, 3.4.2
    • Fix Version/s: 3.12
    • Component/s: naming
    • Labels:
      None

      Description

      When iterating through the JNDI tree in Geronimo with the following code

      		NamingEnumeration<Binding> namingEnum = context.listBindings("");
      		while (namingEnum.hasMore()) {
      			Binding nameClassPair = namingEnum.nextElement();
                              if (nameClassPair.isRelative()) {
      

      the isRelative() test always fails. The object returned from the nextElement() call is a ContextUtil$ReadOnlyBinding which has a trivial implementation of the isRelative() method:

              public boolean isRelative() {
                  return false;
              }
      

      Since the ReadOnlyBinding inherits from the NameClassPair it has a instance var named isRelative and inherits a method isRelative() which – at least in my case – has the correct default value of "true". So, the method could be simply deleted so that the original method is used.

      However, I haven't dug deep enough into the code to assess if the property is initialized correctly at any time, i.e. for the top level JNDI entries one might assume that those return "false" (OTOH would that really be necessary? In what situation should the NameClassPair return "false" for isRelative ?)

      Relates to http://issues.apache.org/jira/browse/GERONIMO-4477

        Issue Links

          Activity

          Christian Haul created issue -
          Christian Haul made changes -
          Field Original Value New Value
          Link This issue is depended upon by GERONIMO-4477 [ GERONIMO-4477 ]
          Hide
          Jack Cai added a comment -

          Created a patch based on the above suggestion.

          Show
          Jack Cai added a comment - Created a patch based on the above suggestion.
          Jack Cai made changes -
          Attachment XBean_119.patch [ 12401723 ]
          David Jencks made changes -
          Component/s naming [ 12311432 ]
          Hide
          Guillaume Nodet added a comment -

          Sending src/main/java/org/apache/xbean/naming/context/ContextUtil.java
          Transmitting file data .
          Committed revision 1393337.

          Show
          Guillaume Nodet added a comment - Sending src/main/java/org/apache/xbean/naming/context/ContextUtil.java Transmitting file data . Committed revision 1393337.
          Guillaume Nodet made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Guillaume Nodet [ gnt ]
          Fix Version/s 3.12 [ 12321694 ]
          Resolution Fixed [ 1 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          1380d 15h 42m 1 Guillaume Nodet 03/Oct/12 09:20

            People

            • Assignee:
              Guillaume Nodet
              Reporter:
              Christian Haul
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development