Harmony
  1. Harmony
  2. HARMONY-855

[Classlib][util]Some java.uiti.Collections methods do not throw unspecified NPE while RI does

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      Windows XP professional
    • Estimated Complexity:
      Novice

      Description

      Build: classlib+VM revision 421248 msvc debug

      Problem:

      Some Collections.checked... methods throw NPE if one of their arguments is null in RI but don't throw in Harmony

      Code to reproduce:

      import java.util.*;

      public class Test {
      public static void main (String[] args) {
      try

      { Collections.checkedSortedMap(new TreeMap(), null, Short.TYPE); System.err.println("fail 1"); }

      catch (NullPointerException e) {
      }
      try

      { Collections.checkedSortedMap(new TreeMap(), Float.TYPE, null); System.err.println("fail 1.1"); }

      catch (NullPointerException e) {
      }
      try

      { Collections.checkedMap(new TreeMap(), null, Float.TYPE); System.err.println("fail 2"); }

      catch (NullPointerException e) {
      }
      try

      { Collections.checkedMap(new TreeMap(), Float.TYPE, null); System.err.println("fail 2.2"); }

      catch (NullPointerException e) {
      }
      try

      { Collections.checkedCollection(new Stack(), null); System.err.println("fail 3"); }

      catch (NullPointerException e) {
      }
      }
      }

      in RI this test prints nothing, in Harmony all 'fail' messages are printed

      Please see the patch attached. It contains:

      • JUnit test for the problem
      • patch for java.util.Collections
      1. harmony-855.diff
        4 kB
        spark shen
      2. patch.txt
        4 kB
        Anton Luht

        Activity

        Hide
        Paulex Yang added a comment -

        Verified by Anton and Spark.

        Show
        Paulex Yang added a comment - Verified by Anton and Spark.
        Hide
        spark shen added a comment -

        Veryfied at r447694

        Show
        spark shen added a comment - Veryfied at r447694
        Hide
        Paulex Yang added a comment -

        Anton and Spark, updated patch applied at revision r447348, thanks a lot for this enhancement, please verify that the problem is fully fixed as you expected.

        Show
        Paulex Yang added a comment - Anton and Spark, updated patch applied at revision r447348, thanks a lot for this enhancement, please verify that the problem is fully fixed as you expected.
        Hide
        Anton Luht added a comment -

        the patch applied correctly to r447316 and fixed the problem

        Show
        Anton Luht added a comment - the patch applied correctly to r447316 and fixed the problem
        Hide
        spark shen added a comment -

        BTW, would any commiter please change the component to classlib.

        Show
        spark shen added a comment - BTW, would any commiter please change the component to classlib.
        Hide
        spark shen added a comment -

        The old patch of JIRA 855 is outdated. I update the patch
        for this JIRA. Would you please try this new one?

        Best regards

        Show
        spark shen added a comment - The old patch of JIRA 855 is outdated. I update the patch for this JIRA. Would you please try this new one? Best regards
        Hide
        Anton Luht added a comment -

        patch

        Show
        Anton Luht added a comment - patch

          People

          • Assignee:
            Paulex Yang
            Reporter:
            Anton Luht
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development