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

The trim() statement in getHeaderFieldDate(String, long) ignores the return value

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      generic

      Description

      The trim() statement in method getHeaderFieldDate, class java.netHttpURLConnection ignores the return value.

          public long getHeaderFieldDate(String name, long Default) {
      String dateString = getHeaderField(name);
      try {
      dateString.trim();
      if (dateString.indexOf("GMT") == -1) {
      dateString = dateString+" GMT";
      }
      return Date.parse(dateString);
      } catch (Exception e) {
      }
      return Default;
          }


      Strings are immutable, the trim function

      dateString.trim();

      returns a new String value, which is being ignored here. It should be

      dateString = dateString.trim();

      ###@###.### 2005-1-26 16:25:55 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jccollet Jean-Christophe Collet (Inactive)
                Reporter:
                jloefflm Johann Löfflmann (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: