-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b63
-
generic, x86
-
solaris_8, windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The format() method of java.util.Formatter is ending the application abruptly when an exception was expected.
When I am trying to format a character (fromat specifier - c) with invalid values such as negative number (type casted to byte or short) the application is ending abruptly instead of throwing exceptions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please execute the sample program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Since invalid values are passes, exceptions are expected to be thrown. Thus for the "sample program" submitted I expected exception stack trace.
ACTUAL -
Application ended abruptly with message
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class BugTest
{
public static void main(String arg[])
{
Formatter frmt=new Formatter();
try
{
frmt.format("char=\"%c\"\n",Integer.MAX_VALUE);
}catch(Throwable ex)
{
ex.printStackTrace();
}
System.out.print(frmt.out());
System.out.println("Completed");
}
}
---------- END SOURCE ----------
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The format() method of java.util.Formatter is ending the application abruptly when an exception was expected.
When I am trying to format a character (fromat specifier - c) with invalid values such as negative number (type casted to byte or short) the application is ending abruptly instead of throwing exceptions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please execute the sample program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Since invalid values are passes, exceptions are expected to be thrown. Thus for the "sample program" submitted I expected exception stack trace.
ACTUAL -
Application ended abruptly with message
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class BugTest
{
public static void main(String arg[])
{
Formatter frmt=new Formatter();
try
{
frmt.format("char=\"%c\"\n",Integer.MAX_VALUE);
}catch(Throwable ex)
{
ex.printStackTrace();
}
System.out.print(frmt.out());
System.out.println("Completed");
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-5034423 (fmt) uncaught IllegalFormatCodePointException not printed
-
- Closed
-