Harmony
  1. Harmony
  2. HARMONY-6504

[classlib][luni]Harmony returns null for header related function when file URL is handled

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M14
    • Fix Version/s: 5.0M13
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      All platforms
    • Patch Info:
      Patch Available

      Description

      Header related functions [getHeaderField(int)/getHeaderFieldKey(int)/getHeaderField(String)/getLastModified()] returns null when file URL is handled.

      Consider the following test function, which fails with Harmony

      public void test() throws Exception

      { String resourceName = "org/apache/harmony/luni/tests/"; //folder name URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); FileURLConnection conn = new FileURLConnection(url); assertNotNull(conn.getInputStream()); assertEquals(conn.getContentType(), conn.getHeaderField("content-type")) ; resourceName = "org/apache/harmony/luni/tests/" "test.rtf";; //folder name url = ClassLoader.getSystemClassLoader().getResource(resourceName); conn = new FileURLConnection(url); assertNotNull(conn.getInputStream()); assertEquals(conn.getContentType(), conn.getHeaderField("content-type")) ; assertEquals(Integer.toString(conn.getContentLength()), conn.getHeaderField("content-length")) ; assertEquals(conn.getHeaderField(0), conn.getHeaderField("content-type")); assertEquals(conn.getHeaderField(1), conn.getHeaderField("content-length")); assertEquals(conn.getHeaderField(2), conn.getHeaderField("last-modified")); assertEquals("last-modified", conn.getHeaderFieldKey(2)); assertEquals("content-length", conn.getHeaderFieldKey(1)); assertEquals("content-type", conn.getHeaderFieldKey(0)); }

      Thanks and Regards,
      Mohan

      1. URLConnection.HARMONY-6504.diff
        1 kB
        Kevin Zhou
      2. HARMONY-6504.diff
        7 kB
        Mohanraj Loganathan

        Activity

          People

          • Assignee:
            Kevin Zhou
            Reporter:
            Mohanraj Loganathan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development