From 80a86736aa7612b16e557b4fa9ce671ac257350a Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Wed, 8 Mar 2000 21:56:41 +0000 Subject: [PATCH] Fix equals and enhance error checking X-SVN-Rev: 917 --- icu4j/src/com/ibm/icu/text/UnicodeSet.java | 9 +++++++-- icu4j/src/com/ibm/text/UnicodeSet.java | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/icu4j/src/com/ibm/icu/text/UnicodeSet.java b/icu4j/src/com/ibm/icu/text/UnicodeSet.java index 864cafd8a3..a46aa79112 100755 --- a/icu4j/src/com/ibm/icu/text/UnicodeSet.java +++ b/icu4j/src/com/ibm/icu/text/UnicodeSet.java @@ -229,7 +229,7 @@ import java.text.*; * *Unsupported by Java (and hence unsupported by UnicodeSet). * * @author Alan Liu - * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.12 $ $Date: 2000/02/29 01:19:02 $ + * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.13 $ $Date: 2000/03/08 21:56:41 $ */ public class UnicodeSet implements UnicodeFilter { /** @@ -635,7 +635,7 @@ public class UnicodeSet implements UnicodeFilter { */ public boolean equals(Object o) { return o instanceof UnicodeSet && - pairs.equals(((UnicodeSet)o).pairs); + pairs.toString().equals(((UnicodeSet)o).pairs.toString()); } /** @@ -901,6 +901,11 @@ public class UnicodeSet implements UnicodeFilter { } } + if (mode == 0) { + throw new IllegalArgumentException("Missing '[' in \"" + + pattern.substring(start) + '"'); + } + // Handle unprocessed stuff preceding the closing ']' if (lastOp == '-') { // Trailing '-' is treated as literal diff --git a/icu4j/src/com/ibm/text/UnicodeSet.java b/icu4j/src/com/ibm/text/UnicodeSet.java index 864cafd8a3..a46aa79112 100755 --- a/icu4j/src/com/ibm/text/UnicodeSet.java +++ b/icu4j/src/com/ibm/text/UnicodeSet.java @@ -229,7 +229,7 @@ import java.text.*; * *Unsupported by Java (and hence unsupported by UnicodeSet). * * @author Alan Liu - * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.12 $ $Date: 2000/02/29 01:19:02 $ + * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.13 $ $Date: 2000/03/08 21:56:41 $ */ public class UnicodeSet implements UnicodeFilter { /** @@ -635,7 +635,7 @@ public class UnicodeSet implements UnicodeFilter { */ public boolean equals(Object o) { return o instanceof UnicodeSet && - pairs.equals(((UnicodeSet)o).pairs); + pairs.toString().equals(((UnicodeSet)o).pairs.toString()); } /** @@ -901,6 +901,11 @@ public class UnicodeSet implements UnicodeFilter { } } + if (mode == 0) { + throw new IllegalArgumentException("Missing '[' in \"" + + pattern.substring(start) + '"'); + } + // Handle unprocessed stuff preceding the closing ']' if (lastOp == '-') { // Trailing '-' is treated as literal