-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.0.2
-
sparc
-
solaris_2.5
This bug report includes a description and test of the bug in 1254002, but includes another case. On the outside chance that they're actually different problems, here's another bug.
From: Ludovic Poitou - SunSoft ICNC <Ludovic.Poitou@France>
This does not look like form output to me.
This is a BUG, on JDK 1.0.2.
wait (long timeout) from class Object exits immediately when the timeout value
is bigger than Integer.MAX_VALUE (excepted for Long.MAX_VALUE).
The bug has been discovered on an SS5 running Solaris 2.5.1, while testing a
Java networking application.
Following is an example that show the bug.
Regards,
Ludovic Poitou
import java.lang.*;
class BugWait extends Thread
{
static public void main(String args[])
{
BugWait bug = new BugWait();
bug.start();
}
public synchronized void run()
{
long wait_param;
/* Wait doesn't wait !! */
wait_param = Long.MAX_VALUE - 1L;
System.out.println("WAIT(" + wait_param + ") = Long.MAX_VALUE - 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- Next test ---");
/* Wait doesn't wait !! */
wait_param = ((long) Integer.MAX_VALUE) + 1L;
System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE + 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- Next test ---");
System.out.println("Works with the following values...\\nYou should interrupt it with ^C (it'll wait for a long time)");
wait_param = Long.MAX_VALUE;
System.out.println("WAIT(" + wait_param + ") = Long.MAX_VALUE");
// wait_param = Integer.MAX_VALUE;
// System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE");
// wait_param = ((long) Integer.MAX_VALUE) - 1L;
// System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE - 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- End of test ---");
}
}
From: Ludovic Poitou - SunSoft ICNC <Ludovic.Poitou@France>
This does not look like form output to me.
This is a BUG, on JDK 1.0.2.
wait (long timeout) from class Object exits immediately when the timeout value
is bigger than Integer.MAX_VALUE (excepted for Long.MAX_VALUE).
The bug has been discovered on an SS5 running Solaris 2.5.1, while testing a
Java networking application.
Following is an example that show the bug.
Regards,
Ludovic Poitou
import java.lang.*;
class BugWait extends Thread
{
static public void main(String args[])
{
BugWait bug = new BugWait();
bug.start();
}
public synchronized void run()
{
long wait_param;
/* Wait doesn't wait !! */
wait_param = Long.MAX_VALUE - 1L;
System.out.println("WAIT(" + wait_param + ") = Long.MAX_VALUE - 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- Next test ---");
/* Wait doesn't wait !! */
wait_param = ((long) Integer.MAX_VALUE) + 1L;
System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE + 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- Next test ---");
System.out.println("Works with the following values...\\nYou should interrupt it with ^C (it'll wait for a long time)");
wait_param = Long.MAX_VALUE;
System.out.println("WAIT(" + wait_param + ") = Long.MAX_VALUE");
// wait_param = Integer.MAX_VALUE;
// System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE");
// wait_param = ((long) Integer.MAX_VALUE) - 1L;
// System.out.println("WAIT(" + wait_param + ") = Integer.MAX_VALUE - 1");
try {
long Now = System.currentTimeMillis();
wait(wait_param);
System.out.println("Waited for " + (long)(System.currentTimeMillis() -
Now));
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
System.out.println("--- End of test ---");
}
}
- duplicates
-
JDK-1254002 Object.wait( long timeout ) does not wait if timeout is Long.MAX_VALUE -1
-
- Closed
-