Commons JXPath
  1. Commons JXPath
  2. JXPATH-15

JXPathContextFactory doesn't cache most common result of search

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      JXPathContextFactory's search for a factory class name caches all values
      returned in the search except the default value. This means that in the
      default case (which is the most common, obviously), the search is performed
      every time, which is quite expensive.

      this is the problem method:
      private static String findFactory(String property, String defaultFactory)

      note that it does not cache the value of defaultFactory in the foundFactory
      class variable when that is the value returned.

      suggest adding
      foundFactory = defaultFactory;
      return foundFactory;

      in place of
      return defaultFactory;

      at the end of this method.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Eric Friedman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development