Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323624

ProviderList.ServiceList does not need to be a list

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 23
    • None
    • security-libs

    Description

      There is a providerIndex field that means "the next provider we need to query" and it's never reset, which means the list can only be iterated once. Some of its methods like size() and get() cannot be called, otherwise it updates providerIndex and iterating it will either skip some items or fail.

      While JDK iterates each ServiceList only once and never call the other methods, there is a risk that someone will forget this rule. Also, when running in a debugger, the debugger might call size() automatically to show the content of this object and it could make the object not useable.

      Since it's always only iterated once, we can rewrite it as an Iterator.

      Attachments

        Issue Links

          Activity

            People

              weijun Weijun Wang
              weijun Weijun Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: