Name: gm110360 Date: 10/16/2003
FULL PRODUCT VERSION :
Java Version "1.4.1_01"
JAVA(TM) 2 Runtime Emnvironment, Standard Edition, (build 1.4.1_01-b01)
JAVA Hotspot (TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows 2000 Ver 5.00.2195
A DESCRIPTION OF THE PROBLEM :
Reference bug report # 4717216.
The misleading documentation for the behavour of getTime
and getNanos methods of the Timestamp class have not yet
been fixed.
Even given the change from getTime() returning actual
milliseconds rather than the integral second as milliseconds
in previous versions the getNanos() method should be
updated to be consistent. In the past the nanos value of
the Timestamp was periodic on a second interval (i.e.
described completely the fractional second value) the new
nanos value (1.4.1) should be periodic with millisecond
(i.e. descibe the factional part of a millisecond) so that
a valid value can be obtained from getTime() + getNanos
()/1000000.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the supplied code snippet
EXPECTED VERSUS ACTUAL BEHAVIOR :
Under previous version to 1.4.1
before setTime(): millis=964390697000 nanos=401826336
after setTime(): millis=964390697000 nanos=401826336
before setTime(): millis=0 nanos=30
after setTime(): millis=0 nanos=30
before setTime(): millis=0 nanos=300000000
after setTime(): millis=0 nanos=300000000
Under version 1.4.1_01
before setTime(): millis=964390697000 nanos=401826336
after setTime(): millis=964390697401 nanos=401826336
before setTime(): millis=0 nanos=30
after setTime(): millis=0 nanos=30
before setTime(): millis=0 nanos=300000000
after setTime(): millis=300 nanos=300000000
I would contend that the nanaos value in the final example
should be 0. i.e. millis=300 nanos=0000000
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.sql.Timestamp;
public class Tstest {
Timestamp TS = null;
public Tstest(long millis) {
TS = new Timestamp(millis);
}
public void testit(long millis, int nanos)
{
System.out.println(" before setTime(): millis="+millis+"
nanos="+nanos);
TS.setTime(millis);
TS.setNanos(nanos);
long testmillis= TS.getTime();
int testnanos= TS.getNanos();
System.out.println(" after setTime(): millis="+testmillis+"
nanos="+testnanos);
}
public static void main(String[] args)
{
long millis = (long)964390697000L;
int nanos = 401826336;
Tstest mtest = new Tstest((long)0);
mtest.testit(millis, nanos);
mtest.testit(0L, 30);
mtest.testit(0L, 300000000);
}
}
---------- END SOURCE ----------
(Incident Review ID: 180882)
======================================================================
FULL PRODUCT VERSION :
Java Version "1.4.1_01"
JAVA(TM) 2 Runtime Emnvironment, Standard Edition, (build 1.4.1_01-b01)
JAVA Hotspot (TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows 2000 Ver 5.00.2195
A DESCRIPTION OF THE PROBLEM :
Reference bug report # 4717216.
The misleading documentation for the behavour of getTime
and getNanos methods of the Timestamp class have not yet
been fixed.
Even given the change from getTime() returning actual
milliseconds rather than the integral second as milliseconds
in previous versions the getNanos() method should be
updated to be consistent. In the past the nanos value of
the Timestamp was periodic on a second interval (i.e.
described completely the fractional second value) the new
nanos value (1.4.1) should be periodic with millisecond
(i.e. descibe the factional part of a millisecond) so that
a valid value can be obtained from getTime() + getNanos
()/1000000.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the supplied code snippet
EXPECTED VERSUS ACTUAL BEHAVIOR :
Under previous version to 1.4.1
before setTime(): millis=964390697000 nanos=401826336
after setTime(): millis=964390697000 nanos=401826336
before setTime(): millis=0 nanos=30
after setTime(): millis=0 nanos=30
before setTime(): millis=0 nanos=300000000
after setTime(): millis=0 nanos=300000000
Under version 1.4.1_01
before setTime(): millis=964390697000 nanos=401826336
after setTime(): millis=964390697401 nanos=401826336
before setTime(): millis=0 nanos=30
after setTime(): millis=0 nanos=30
before setTime(): millis=0 nanos=300000000
after setTime(): millis=300 nanos=300000000
I would contend that the nanaos value in the final example
should be 0. i.e. millis=300 nanos=0000000
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.sql.Timestamp;
public class Tstest {
Timestamp TS = null;
public Tstest(long millis) {
TS = new Timestamp(millis);
}
public void testit(long millis, int nanos)
{
System.out.println(" before setTime(): millis="+millis+"
nanos="+nanos);
TS.setTime(millis);
TS.setNanos(nanos);
long testmillis= TS.getTime();
int testnanos= TS.getNanos();
System.out.println(" after setTime(): millis="+testmillis+"
nanos="+testnanos);
}
public static void main(String[] args)
{
long millis = (long)964390697000L;
int nanos = 401826336;
Tstest mtest = new Tstest((long)0);
mtest.testit(millis, nanos);
mtest.testit(0L, 30);
mtest.testit(0L, 300000000);
}
}
---------- END SOURCE ----------
(Incident Review ID: 180882)
======================================================================