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

URLReader constructor should allow specifying encoding

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 9
    • core-libs
    • None
    • b96
    • generic
    • generic

    Description

      The class jdk.nashorn.api.scripting.URLReader should allow the caller to specify the encoding to be used by InputStreamReader, and not let it default to the platform encoding (most applications would want to use utf8 for the encoding).

      The private url field could be declared final.

      Also wondering why the internal reader is created lazily - in almost all cases the URLReader *will* be used to read from the underlying URL. Creating the internal reader eagerly in the constructor would allow it to be declared final and be rid of the synchronized on lock which is currently acquired on every read, slowing down every read.

      Attachments

        Activity

          People

            sundar Sundararajan Athijegannathan
            akhil Akhil Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: