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

Charset.isSupported() performs too expensive

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 7
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      - In class Charset move shortcut handling for extendedProvider from lookupExtendedCharset() inside to method lookupViaProviders().
      - May be instantiate ExtendedCharsets as singleton.

      JUSTIFICATION :
      Every time, if lookupExtendedCharset() fails for particular charset, a new ExtendedCharsets object will be instantiated by lookupViaProviders(), which just as well must fail.
      Additionally, static variable ExtendedCharsets.instance would be updated, so from this time, it holds different instance than cached in Charset.extendedProvider variable.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      First instantiation of ExtendedCharsets should be reused by lookupViaProviders().
      ACTUAL -
      Invocation of Charset.isSupported() or Charset.forName() instantiates and initializes superfluous ExtendedCharsets object.

            sherman Xueming Shen
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: