BUG: java.text.DateFormat.parse() Throws a NullPointerException

Last reviewed: January 29, 1998
Article ID: Q177751
The information in this article applies to:
  • SDK for Java, version 2.0
  • Microsoft Internet Explorer version 4.0 for Windows NT 4.0 on the following platforms: NT, Win95
  • Microsoft Win32 Virtual Machine for Java

SYMPTOMS

When the parse() method of the java.text.DateFormat cannot parse a date, the Microsoft Virtual Machine for Java incorrectly throws a NullPointerException error instead of a ParseException error.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Java project and include the following class:

          class test
          {
    
             public static void main(String[] args)
             {
                try
                {
                   java.text.DateFormat Df;
                   Df = java.text.DateFormat.getDateInstance();
                   Df.parse("Foo");
                   System.out.println ("Done.");
                }
                catch(Exception e)
                {
                   System.err.println("caught exception");
                   e.printStackTrace();
                }
             }
          }
    
    
java.text.DateFormat is a package that is included with JDK1.1. Build the above code with the JVC that is provided in the SDK2.0 for Java and execute. You will see that the Virtual Machine throws a NullPointerException instead of ParseException as mentioned in the Documentation.

REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/
   http://support.microsoft.com/support/java/


Additional query words: DateFormat parse exception

Keywords : JVM
Technology : kbInetDev internet
Version : WINDOWS:2.0,4.0
Platform : WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 29, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.