This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178432 - Date class in package java.sql and java.util bahaves abnormally
Summary: Date class in package java.sql and java.util bahaves abnormally
Status: RESOLVED WORKSFORME
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-10 08:02 UTC by sultanmaiyaki
Modified: 2011-02-15 07:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sultanmaiyaki 2009-12-10 08:02:25 UTC
In a bit to convert java date types to sql date types, it was observed that whenever the Date class of the java.sql package is invoked, it sometimes flag an error in the code or generate an error report when the code is executed.

After this observation, thesame code was wrtten in a notepad which executed successfully in the command prompt.

Below is a snippet of the source code and output in netbeans 6.7.1.

public class Trial
{
	
      	public void insertClock()
	{
		java.util.Date javaDate = new java.util.Date();
                

                java.sql.Date sqlDate = new java.sql.Date(javaDate.getTime());
                
                System.out.println("Current utility date " +javaDate);
                System.out.println("Sql current date " +sqlDate);
        }

        public static void main(String args[])
        {
            Trial x = new Trial();
            x.insertClock();
        }
}	

output:

run:
Exception in thread "main" java.lang.UnsupportedOperationException: Not yet implemented
        at java$util$Date.getTime(java.java:40)
        at Trial.insertClock(Trial.java:10)
        at Trial.main(Trial.java:19)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

below is the output of thesame code when executed from command prompt:

C:\JFiles\start>javac Trial.java

C:\JFiles\start>java Trial
Current utility date Thu Dec 10 20:50:49 SGT 2009
Sql current date 2009-12-10
Comment 1 Jiri Rechtacek 2011-02-15 07:22:41 UTC
We are trying to prioritize bugs but do not have time to evaluate all open P3s, please reopen if you feel this bug is still valid.