Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2126

NodeIterator.hasNext() method returns wrong results

    XMLWordPrintable

    Details

      Description

      According to API , NodeIterator.hasNext() method should return same result if next() method is not called meanwhile. This is not the case in some situations, when I do some node adding combined with calling clone().

      Fortunately there is a workaround to call session.save() before calling hasNext() method. See attached code.

      example:

              NodeIterator nodeIter = refNode.getNodes("name");
              
              boolean hasnext1 = nodeIter.hasNext();
              boolean hasnext2 = nodeIter.hasNext();
              boolean hasnext3 = nodeIter.hasNext();
      
              System.out.println("CALL1" + hasnext1);
              System.out.println("CALL2" + hasnext2);
              System.out.println("CALL3" + hasnext3);
      

      will output:

      CALL1true
      CALL2false
      CALL3false
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                mkuzela Martin Kuzela
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: