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

unused local variable ba in URI decode(String s) method

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • core-libs
    • x86
    • linux

      A DESCRIPTION OF THE REQUEST :
      Every call to the decode(String s) method in the URI class in which s contains at least one '%' character results in a needless allocation of a byte array of length s.length(). Unless I am missing something, this array is never used.

      JUSTIFICATION :
      There is no point allocating (and then garbage collecting) an unused array every time this method is called.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No allocation of unused byte array.
      ACTUAL -
      Allocation of unused byte array.

      ---------- BEGIN SOURCE ----------
      // remove the line below from java/net/URI.java
      // in jdk 1.6 beta 2 it is line 2966

      byte[] ba = new byte[n];
      ---------- END SOURCE ----------

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: