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. patch.txt
        4 kB
        Anton Luht
      2. harmony-855.diff
        4 kB
        spark shen

        Activity

        Paulex Yang made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Paulex Yang made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Paulex Yang made changes -
        Assignee Paulex Yang [ paulex ]
        Paulex Yang made changes -
        Component/s Non-bug differences from RI [ 12310780 ]
        Component/s Classlib [ 12310560 ]
        Summary Some java.uiti.Collections methods do not throw unspecified NPE while RI does [Classlib][util]Some java.uiti.Collections methods do not throw unspecified NPE while RI does
        spark shen made changes -
        Attachment harmony-855.diff [ 12341026 ]
        Anton Luht made changes -
        Field Original Value New Value
        Attachment patch.txt [ 12336741 ]
        Anton Luht created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development