diff options
author | prr <none@none> | 2008-05-13 16:18:30 -0700 |
---|---|---|
committer | prr <none@none> | 2008-05-13 16:18:30 -0700 |
commit | 81dcb5c8e4eb8da470a3613f36eb8206ae2719dc (patch) | |
tree | 07207844d40e9383d2a8b5ca851f1cd2e9c48c73 /src/share/classes/sun/java2d | |
parent | df75909632c5442a36ec634f169cfe3158eeaf7b (diff) |
6699843: IllegalArgumentException when using Graphics.drawString( "", 0, 0 )
Reviewed-by: igor, tdv
Diffstat (limited to 'src/share/classes/sun/java2d')
-rw-r--r-- | src/share/classes/sun/java2d/SunGraphics2D.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/share/classes/sun/java2d/SunGraphics2D.java b/src/share/classes/sun/java2d/SunGraphics2D.java index 887f4c91e..921ece415 100644 --- a/src/share/classes/sun/java2d/SunGraphics2D.java +++ b/src/share/classes/sun/java2d/SunGraphics2D.java @@ -2805,6 +2805,9 @@ public final class SunGraphics2D } if (font.hasLayoutAttributes()) { + if (str.length() == 0) { + return; + } new TextLayout(str, font, getFontRenderContext()).draw(this, x, y); return; } @@ -2831,6 +2834,9 @@ public final class SunGraphics2D } if (font.hasLayoutAttributes()) { + if (str.length() == 0) { + return; + } new TextLayout(str, font, getFontRenderContext()).draw(this, x, y); return; } @@ -2856,6 +2862,9 @@ public final class SunGraphics2D if (iterator == null) { throw new NullPointerException("AttributedCharacterIterator is null"); } + if (iterator.getBeginIndex() == iterator.getEndIndex()) { + return; /* nothing to draw */ + } TextLayout tl = new TextLayout(iterator, getFontRenderContext()); tl.draw(this, (float) x, (float) y); } @@ -2865,6 +2874,9 @@ public final class SunGraphics2D if (iterator == null) { throw new NullPointerException("AttributedCharacterIterator is null"); } + if (iterator.getBeginIndex() == iterator.getEndIndex()) { + return; /* nothing to draw */ + } TextLayout tl = new TextLayout(iterator, getFontRenderContext()); tl.draw(this, x, y); } @@ -2900,6 +2912,9 @@ public final class SunGraphics2D throw new ArrayIndexOutOfBoundsException("bad offset/length"); } if (font.hasLayoutAttributes()) { + if (data.length == 0) { + return; + } new TextLayout(new String(data, offset, length), font, getFontRenderContext()).draw(this, x, y); return; @@ -2934,6 +2949,9 @@ public final class SunGraphics2D chData[i] = (char)(data[i+offset] & 0xff); } if (font.hasLayoutAttributes()) { + if (data.length == 0) { + return; + } new TextLayout(new String(chData), font, getFontRenderContext()).draw(this, x, y); return; |