-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b28
-
x86
-
windows_xp
-
Verified
FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Running the attached code causes the attached IllegalArgumentException.
When the following line is removed, the exception is not thrown anymore.
map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL );
This seems to be related to Bug #6478336 which was correctly fixed in 6u2(b01).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code with JRE 1.6.0_02.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Do nothing. Drawing an empty string should not do anything.
ACTUAL -
The code throws the attached IllegalArgumentException.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Zero length string passed to TextLayout constructor.
at java.awt.font.TextLayout.<init>(Unknown Source)
at sun.java2d.SunGraphics2D.drawString(Unknown Source)
at TestClass.main(TestClass.java:21)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class TestClass {
public static void main( String args[] ) {
BufferedImage bi = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB );
Graphics g = bi.getGraphics();
Font f = new Font( "Dialog", Font.PLAIN, 12 );
Map map = new HashMap();
map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL );
f = f.deriveFont( map );
g.setFont( f );
g.drawString( "", 0, 0 );
}
}
---------- END SOURCE ----------
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Running the attached code causes the attached IllegalArgumentException.
When the following line is removed, the exception is not thrown anymore.
map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL );
This seems to be related to Bug #6478336 which was correctly fixed in 6u2(b01).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code with JRE 1.6.0_02.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Do nothing. Drawing an empty string should not do anything.
ACTUAL -
The code throws the attached IllegalArgumentException.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Zero length string passed to TextLayout constructor.
at java.awt.font.TextLayout.<init>(Unknown Source)
at sun.java2d.SunGraphics2D.drawString(Unknown Source)
at TestClass.main(TestClass.java:21)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class TestClass {
public static void main( String args[] ) {
BufferedImage bi = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB );
Graphics g = bi.getGraphics();
Font f = new Font( "Dialog", Font.PLAIN, 12 );
Map map = new HashMap();
map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL );
f = f.deriveFont( map );
g.setFont( f );
g.drawString( "", 0, 0 );
}
}
---------- END SOURCE ----------
- relates to
-
JDK-6478336 Exception measuring zero length string when font has layout attributes.
- Closed
-
JDK-8333026 java/awt/print/PrinterJob/PrintNullString.java failed: FAILURE: No IAE for empty iterator, int
- Open