3 Replies Latest reply on Jan 30, 2012 2:39 PM by zkon

    Strange behavior going from 7.3 to 7.6

    zkon

      Hi,

      I've upgraded from 7.3 to 7.6 and have found that the code that worked in 7.3 no longer works. The reason is that after 'visiting' a where clause, for AndOr, the results differ from the two releases. The where clause has:

      SYSTEM = 'XXXX' AND INTERVAL = 30 AND PERIOD_START = {ts '2012-01-24 19:52:43.0'} AND PERIOD_END = {ts '2012-01-24 19:53:13.0'}

      I then do:

      CollectorVisitor<AndOr> collectorVisitor = new CollectorVisitor<AndOr>(AndOr.class);

      where.acceptVisitor(collectorVisitor);

      Collection<AndOr> conditions = collectorVisitor.getCollectedObjects();

      in 7.3 the conditions array would have one entry that is the whole where clause (the where is actually of type AndOr, so that makes sense). However in 7.6 the exact same code results in TWO array entries.

       

      The first contains:

      INTERVAL = 30 AND PERIOD_START = {ts '2012-01-24 19:52:43.0'} AND PERIOD_END = {ts '2012-01-24 19:53:13.0'}

      The second array entry contains:

      PERIOD_START = {ts '2012-01-24 19:52:43.0'} AND PERIOD_END = {ts '2012-01-24 19:53:13.0'}

       

      This looks wrong/like a bug to me, but I'm as green as oak leaves in spring, so I was hoping that some expert might know what's happening and advise me.

       

      PS This is code in a translator that is interpreting the where clause to construct a query to another application that speaks in tongues.

        • 1. Re: Strange behavior going from 7.3 to 7.6
          rareddy

          zkon,

           

          Which translator shows the above behaviour?

           

          Ramesh..

          • 2. Re: Strange behavior going from 7.3 to 7.6
            shawkins

            zkon,

             

            The CollectorVisitor was changed to be a subclass of HierarchyVisitor.  This wasn't considered a breaking change though as the results from the static CollectorVisitor methods should not be different.  In 7.3 the CollectorVisitor is not intended for use without a DelegatingHierarchyVisitor.  The various behaviors can be summarized as:

             

            7.3 CollectorVisitor.acceptVisitor(...) - collects only the top level object if it matches.  This is really just an instanceof check.

            7.3 using a DelegatingHierarchy visitor or the CollectorVisitor.collectObjects(Class, LanguageObject) static method - returns all AndOr instances, which in your example would be 3 - the top level and the 2 children.

             

            7.6 CollectorVisitor.acceptVisitor(...) - collects only the matching children of the top level object, which is what you show above with the 2 results.

            7.6 CollectorVisitor.collectObjects(Class, LanguageObject) static method - same as 7.3, returns all 3 instances.

             

            I hope this makes more sense.  We can update the javadoc to clarify the usage if needed.

             

            Thanks,

            Steve

            • 3. Re: Strange behavior going from 7.3 to 7.6
              zkon

              Thanks Steve, that looks just like whats happening and I'll change my translator accordingly.

               

              Kon