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

Calendar.setTime(Date date) throws NPE with Date date = null

    XMLWordPrintable

    Details

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

      Description

      A DESCRIPTION OF THE PROBLEM :
      When setting time in Calendar.setTime(Date date), if 'Date date = null' then setTime() results nullPointerException since it is not able to call date.getTime() within itself. This problem needs null check, and possible default value setting if date = null.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the following in Java

      Date date = null;
      Calendar.setTime(date);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Possible default value setting?
      ACTUAL -
      NullPointerException

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: