From 6fc058da980d2f4bbb0036936eef7b11df743565 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 25 Oct 2004 16:56:00 +0000 Subject: [PATCH] WordBreakIterator.java (WordBreakIterator): Don't initialize `iter'. * gnu/java/text/WordBreakIterator.java (WordBreakIterator): Don't initialize `iter'. * gnu/java/text/SentenceBreakIterator.java (SentenceBreakIterator): Don't initialize `iter'. * gnu/java/text/LineBreakIterator.java (LineBreakIterator): Don't initialize `iter'. * gnu/java/text/CharacterBreakIterator.java (CharacterBreakIterator): Don't initialize `iter'. * gnu/java/text/BaseBreakIterator.java (BaseBreakIterator): New constructor. * java/text/BreakIterator.java: Updated documentation. From-SVN: r89539 --- libjava/ChangeLog | 14 ++++++++++++++ libjava/gnu/java/text/BaseBreakIterator.java | 11 ++++++++++- libjava/gnu/java/text/CharacterBreakIterator.java | 3 +-- libjava/gnu/java/text/LineBreakIterator.java | 3 +-- libjava/gnu/java/text/SentenceBreakIterator.java | 3 +-- libjava/gnu/java/text/WordBreakIterator.java | 3 +-- libjava/java/text/BreakIterator.java | 6 +++++- 7 files changed, 33 insertions(+), 10 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 00a4953c30b..f79c8f89396 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,17 @@ +2004-10-25 Tom Tromey + + * gnu/java/text/WordBreakIterator.java (WordBreakIterator): Don't + initialize `iter'. + * gnu/java/text/SentenceBreakIterator.java + (SentenceBreakIterator): Don't initialize `iter'. + * gnu/java/text/LineBreakIterator.java (LineBreakIterator): Don't + initialize `iter'. + * gnu/java/text/CharacterBreakIterator.java + (CharacterBreakIterator): Don't initialize `iter'. + * gnu/java/text/BaseBreakIterator.java (BaseBreakIterator): New + constructor. + * java/text/BreakIterator.java: Updated documentation. + 2004-10-25 Eric Botcazou PR other/18138 diff --git a/libjava/gnu/java/text/BaseBreakIterator.java b/libjava/gnu/java/text/BaseBreakIterator.java index 5bb6f6ecef2..40a698f7cc4 100644 --- a/libjava/gnu/java/text/BaseBreakIterator.java +++ b/libjava/gnu/java/text/BaseBreakIterator.java @@ -1,5 +1,5 @@ /* BaseBreakIterator.java -- Base class for default BreakIterators - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,6 +40,7 @@ package gnu.java.text; import java.text.BreakIterator; import java.text.CharacterIterator; +import java.text.StringCharacterIterator; /** * @author Tom Tromey @@ -48,6 +49,14 @@ import java.text.CharacterIterator; public abstract class BaseBreakIterator extends BreakIterator { + public BaseBreakIterator () + { + // It isn't documented, but break iterators are created in a + // working state; their methods won't throw exceptions before + // setText(). + iter = new StringCharacterIterator(""); + } + public int current () { return iter.getIndex(); diff --git a/libjava/gnu/java/text/CharacterBreakIterator.java b/libjava/gnu/java/text/CharacterBreakIterator.java index 5d2036c3551..c973f7b87f1 100644 --- a/libjava/gnu/java/text/CharacterBreakIterator.java +++ b/libjava/gnu/java/text/CharacterBreakIterator.java @@ -1,5 +1,5 @@ /* CharacterBreakIterator.java - Default character BreakIterator. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -69,7 +69,6 @@ public class CharacterBreakIterator extends BaseBreakIterator public CharacterBreakIterator () { - iter = null; // FIXME? } private CharacterBreakIterator (CharacterBreakIterator other) diff --git a/libjava/gnu/java/text/LineBreakIterator.java b/libjava/gnu/java/text/LineBreakIterator.java index e1cb49c7d56..7f00a95df0c 100644 --- a/libjava/gnu/java/text/LineBreakIterator.java +++ b/libjava/gnu/java/text/LineBreakIterator.java @@ -1,5 +1,5 @@ /* LineBreakIterator.java - Default word BreakIterator. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,7 +55,6 @@ public class LineBreakIterator extends BaseBreakIterator public LineBreakIterator () { - iter = null; } private LineBreakIterator (LineBreakIterator other) diff --git a/libjava/gnu/java/text/SentenceBreakIterator.java b/libjava/gnu/java/text/SentenceBreakIterator.java index 405bbc5408d..3d395872840 100644 --- a/libjava/gnu/java/text/SentenceBreakIterator.java +++ b/libjava/gnu/java/text/SentenceBreakIterator.java @@ -1,5 +1,5 @@ /* SentenceBreakIterator.java - Default sentence BreakIterator. - Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,7 +55,6 @@ public class SentenceBreakIterator extends BaseBreakIterator public SentenceBreakIterator () { - iter = null; } private SentenceBreakIterator (SentenceBreakIterator other) diff --git a/libjava/gnu/java/text/WordBreakIterator.java b/libjava/gnu/java/text/WordBreakIterator.java index 39dbefe6e50..85c44da4569 100644 --- a/libjava/gnu/java/text/WordBreakIterator.java +++ b/libjava/gnu/java/text/WordBreakIterator.java @@ -1,5 +1,5 @@ /* WordBreakIterator.java - Default word BreakIterator. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,7 +55,6 @@ public class WordBreakIterator extends BaseBreakIterator public WordBreakIterator () { - iter = null; } private WordBreakIterator (WordBreakIterator other) diff --git a/libjava/java/text/BreakIterator.java b/libjava/java/text/BreakIterator.java index 92037a3bf55..a79db8c5f23 100644 --- a/libjava/java/text/BreakIterator.java +++ b/libjava/java/text/BreakIterator.java @@ -1,5 +1,5 @@ /* BreakIterator.java -- Breaks text into elements - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,10 @@ import java.util.ResourceBundle; * type is created by calling one of the static factory methods, not * by directly calling a constructor. * + * The standard iterators created by the factory methods in this + * class will be valid upon creation. That is, their methods will + * not cause exceptions if called before you call setText(). + * * @author Tom Tromey * @author Aaron M. Renn (arenn@urbanophile.com) * @date March 19, 1999