From 98615fef3b11060138cb6c911420adcfab20e63c Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 28 Sep 2012 05:42:24 +0100 Subject: PR42134: NullPointerException in java.text.Bidi 2012-09-26 Andrew John Hughes PR classpath/42134 * java/text/Bidi.java: (Bidi(AttributedCharacterIterator)): Remove shadow variable text which hides the instance variable of the same name. Remove unnecessary use of this. * NEWS: Updated. Signed-off-by: Andrew John Hughes --- ChangeLog | 9 +++++++++ NEWS | 3 +++ java/text/Bidi.java | 16 ++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 305bbdb34..007528938 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-09-26 Andrew John Hughes + + PR classpath/42134 + * java/text/Bidi.java: + (Bidi(AttributedCharacterIterator)): Remove shadow + variable text which hides the instance variable + of the same name. Remove unnecessary use of this. + * NEWS: Updated. + 2012-09-24 Andrew John Hughes * tools/com/sun/javadoc/Doc.java: diff --git a/NEWS b/NEWS index 73ba71156..5295681da 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY New in release 1.00 (XXX XX, XXXX) +* Bug fixes: + - PR42134: NPE in java.text.Bidi + New in release 0.99 (Feb 15, 2012) * Addition of java.util.regex.Pattern.quote. diff --git a/java/text/Bidi.java b/java/text/Bidi.java index 532ff4e99..236247d5e 100644 --- a/java/text/Bidi.java +++ b/java/text/Bidi.java @@ -161,13 +161,13 @@ public final class Bidi if (val instanceof NumericShaper) shaper = (NumericShaper) val; - char[] text = new char[iter.getEndIndex() - iter.getBeginIndex()]; - this.embeddings = new byte[this.text.length]; - this.embeddingOffset = 0; - this.length = text.length; - for (int i = 0; i < this.text.length; ++i) + text = new char[iter.getEndIndex() - iter.getBeginIndex()]; + embeddings = new byte[text.length]; + embeddingOffset = 0; + length = text.length; + for (int i = 0; i < text.length; ++i) { - this.text[i] = iter.current(); + text[i] = iter.current(); val = iter.getAttribute(TextAttribute.BIDI_EMBEDDING); if (val instanceof Integer) @@ -178,13 +178,13 @@ public final class Bidi bval = 0; else bval = (byte) ival; - this.embeddings[i] = bval; + embeddings[i] = bval; } } // Invoke the numeric shaper, if specified. if (shaper != null) - shaper.shape(this.text, 0, this.length); + shaper.shape(text, 0, length); runBidi(); } -- cgit v1.2.1