ICU-5145 use IllegalStateException instead of InternalError
X-SVN-Rev: 19560
This commit is contained in:
parent
65924f6b3c
commit
2141d6915d
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -74,7 +74,7 @@ public class ModuleTest extends TestFmwk {
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return target;
|
||||
@ -199,7 +199,7 @@ public class ModuleTest extends TestFmwk {
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -134,7 +134,7 @@ public class TestFmwk extends AbstractTestLog {
|
||||
protected TestGroup(String defaultPackage, String[] classnames,
|
||||
String description) {
|
||||
if (classnames == null) {
|
||||
throw new InternalError("classnames must not be null");
|
||||
throw new IllegalStateException("classnames must not be null");
|
||||
}
|
||||
|
||||
if (defaultPackage == null) {
|
||||
@ -241,9 +241,9 @@ public class TestFmwk extends AbstractTestLog {
|
||||
subtest.params = params;
|
||||
return subtest;
|
||||
} catch (InstantiationException e) {
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -261,7 +261,7 @@ public class TestFmwk extends AbstractTestLog {
|
||||
try {
|
||||
Class cls = Class.forName(name);
|
||||
if (!TestFmwk.class.isAssignableFrom(cls)) {
|
||||
throw new InternalError("class " + name
|
||||
throw new IllegalStateException("class " + name
|
||||
+ " does not extend TestFmwk");
|
||||
}
|
||||
|
||||
@ -1530,7 +1530,7 @@ public class TestFmwk extends AbstractTestLog {
|
||||
Field f = testClass.getField("CLASS_TARGET_NAME");
|
||||
name = (String) f.get(null);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InternalError(
|
||||
throw new IllegalStateException(
|
||||
"static field CLASS_TARGET_NAME must be accessible");
|
||||
} catch (NoSuchFieldException e) {
|
||||
int n = Math.max(name.lastIndexOf('.'), name.lastIndexOf('$'));
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -2154,7 +2154,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
// hmmm... this shouldn't happen. don't want to exit this
|
||||
// fn with timezone improperly set, so just in case
|
||||
TimeZone.setDefault(oldtz);
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
}
|
||||
|
||||
// create DFS that recognizes our bogus time zone, sortof
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2004-2005, International Business Machines
|
||||
* Copyright (c) 2004-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -815,7 +815,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
|
||||
num = numFmt.parse(values[j]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new InternalError("failed to parse test argument");
|
||||
throw new IllegalStateException("failed to parse test argument");
|
||||
}
|
||||
args[0] = num;
|
||||
String result = fmt.format(args);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -324,8 +324,6 @@ public final class UCharacterCaseTest extends TestFmwk
|
||||
}
|
||||
}catch(Exception ex){
|
||||
warnln("Could not find data for BreakIterators");
|
||||
}catch(InternalError e){
|
||||
warnln("Could not find data for BreakIterators");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2005, International Business Machines
|
||||
* Copyright (C) 2001-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -348,13 +348,13 @@ public class ArabicShapingRegTest extends TestFmwk {
|
||||
catch(MissingResourceException e){
|
||||
throw e;
|
||||
}
|
||||
catch (IllegalStateException ie){
|
||||
warnln("IllegalStateException: "+ie.toString());
|
||||
return;
|
||||
}
|
||||
catch (Exception e) {
|
||||
ex = e;
|
||||
}
|
||||
catch (InternalError ie){
|
||||
warnln("InternalError: "+ie.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!test.result.equals(result)) {
|
||||
reportTestFailure(i, test, shaper, result, ex);
|
||||
|
@ -299,7 +299,9 @@ public final class CollectionUtilities {
|
||||
result.append("]");
|
||||
String sresult = result.toString();
|
||||
UnicodeSet doubleCheck = new UnicodeSet(sresult);
|
||||
if (!uset.equals(doubleCheck)) throw new InternalError("Failure to round-trip in pretty-print");
|
||||
if (!uset.equals(doubleCheck)) {
|
||||
throw new IllegalStateException("Failure to round-trip in pretty-print");
|
||||
}
|
||||
return sresult;
|
||||
}
|
||||
|
||||
|
@ -902,7 +902,7 @@ public class ICUServiceTest extends TestFmwk
|
||||
rwlock.releaseRead();
|
||||
errln("no error thrown");
|
||||
}
|
||||
catch (InternalError e) {
|
||||
catch (IllegalStateException e) {
|
||||
logln("OK: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ -910,7 +910,7 @@ public class ICUServiceTest extends TestFmwk
|
||||
rwlock.releaseWrite();
|
||||
errln("no error thrown");
|
||||
}
|
||||
catch (InternalError e) {
|
||||
catch (IllegalStateException e) {
|
||||
logln("OK: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ -961,7 +961,7 @@ public class ICUServiceTest extends TestFmwk
|
||||
nf.addListener(new WrongListener());
|
||||
errln("added wrong listener");
|
||||
}
|
||||
catch (InternalError e) {
|
||||
catch (IllegalStateException e) {
|
||||
logln(e.getMessage());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -839,7 +839,7 @@ Name: Unicode_1_Name
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError("Should never happen.");
|
||||
throw new IllegalStateException("Should never happen.");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2002-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2002-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -49,7 +49,7 @@ public abstract class UnicodePropertySource implements Cloneable {
|
||||
result.filter = (StringFilter)filter.clone();
|
||||
return result;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError("Should never happen.");
|
||||
throw new IllegalStateException("Should never happen.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ public abstract class UnicodePropertySource implements Cloneable {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError("Should never happen.");
|
||||
throw new IllegalStateException("Should never happen.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2002-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2002-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -400,6 +400,9 @@ public class CheckTags {
|
||||
if (!foundRequiredTag) {
|
||||
errln("missing required tag [" + doc.position() + "]");
|
||||
}
|
||||
if (foundInternalTag && !foundDeprecatedTag) {
|
||||
errln("internal tag missing deprecated");
|
||||
}
|
||||
if (foundDraftTag && !foundDeprecatedTag) {
|
||||
errln("draft tag missing deprecated");
|
||||
}
|
||||
@ -410,6 +413,6 @@ public class CheckTags {
|
||||
logln("stable deprecated");
|
||||
}
|
||||
|
||||
return !foundInternalTag && !retainAll;
|
||||
return !retainAll;
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ public class CodeMangler {
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
if (state == 6) {
|
||||
@ -806,7 +806,7 @@ public class CodeMangler {
|
||||
case 4:
|
||||
keyRelVal[2] = line.substring(mark).trim(); break; // found a word, possible rel, and who knows what
|
||||
default:
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class ICUJDKCompare {
|
||||
ignorelist = args[++i];
|
||||
} else {
|
||||
System.err.println("unrecognized argument: " + arg);
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ public class ICUJDKCompare {
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println(e);
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
} else { // a list of ignoreinfo separated by semicolons
|
||||
ignore = ignorelist.split("\\s*;\\s*");
|
||||
@ -181,7 +181,7 @@ public class ICUJDKCompare {
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println(e);
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
} else { // a list of names separated by semicolons
|
||||
names = namelist.split("\\s*;\\s*");
|
||||
@ -450,7 +450,7 @@ public class ICUJDKCompare {
|
||||
MorC t = mr.overrides[i];
|
||||
if (t == null) {
|
||||
// this shouldn't happen, as the target record should not have been modified
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (removeOverridden(t)) {
|
||||
result = true;
|
||||
@ -701,7 +701,7 @@ public class ICUJDKCompare {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw new InternalError("could not find primitive class: " + cls);
|
||||
throw new IllegalStateException("could not find primitive class: " + cls);
|
||||
}
|
||||
|
||||
static boolean assignableFrom(Class lhs, Class rhs) {
|
||||
|
@ -107,7 +107,7 @@ public abstract class ICUTaglet implements Taglet {
|
||||
for (int i = 0; i < tags.length; ++i) {
|
||||
msg += " [" + i + "] " + tags[i] + "\n";
|
||||
}
|
||||
throw new InternalError(msg);
|
||||
throw new IllegalStateException(msg);
|
||||
} else if (tags.length > 0) {
|
||||
return toString(tags[0]);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class ReportAPI {
|
||||
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, "UTF-8")));
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
throw new InternalError(); // UTF-8 should always be supported
|
||||
throw new IllegalStateException(); // UTF-8 should always be supported
|
||||
}
|
||||
|
||||
DateFormat fmt = new SimpleDateFormat("yyyy");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2000-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -362,7 +362,7 @@ class IndicInputMethodImpl {
|
||||
ACIText clone = (ACIText) super.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2005-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -74,7 +74,7 @@ public class IndexGenerator {
|
||||
System.out.println("Usage: IndexGenerator inDir outDir");
|
||||
System.out.println(" inDir is an existing directory whose locale-based resources are to be enumerated");
|
||||
System.out.println(" outDir is an existing directory in which the res_index.txt file will be placed");
|
||||
throw new InternalError("Usage");
|
||||
throw new IllegalStateException("Usage");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2005, International Business Machines
|
||||
* Copyright (C) 2005-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -12,12 +12,12 @@ public class Assert {
|
||||
fail(e.toString()); // can't wrap exceptions in jdk 1.3
|
||||
}
|
||||
public static void fail(String msg) {
|
||||
throw new InternalError("failure '" + msg + "'");
|
||||
throw new IllegalStateException("failure '" + msg + "'");
|
||||
}
|
||||
public static void assrt(boolean val) {
|
||||
if (!val) throw new InternalError("assert failed");
|
||||
if (!val) throw new IllegalStateException("assert failed");
|
||||
}
|
||||
public static void assrt(String msg, boolean val) {
|
||||
if (!val) throw new InternalError("assert '" + msg + "' failed");
|
||||
if (!val) throw new IllegalStateException("assert '" + msg + "' failed");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2005, International Business Machines
|
||||
* Copyright (c) 2002-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -51,7 +51,7 @@ class ICUBinaryStream extends DataInputStream {
|
||||
reset();
|
||||
int actual = skipBytes(offset);
|
||||
if (actual != offset) {
|
||||
throw new InternalError("Skip(" + offset + ") only skipped " +
|
||||
throw new IllegalStateException("Skip(" + offset + ") only skipped " +
|
||||
actual + " bytes");
|
||||
}
|
||||
if (false) System.out.println("(seek " + offset + ")");
|
||||
|
@ -177,7 +177,7 @@ public class ICUListResourceBundle extends ListResourceBundle {
|
||||
stream.reset();
|
||||
length <<= 1;
|
||||
} else {
|
||||
throw new InternalError("maximum input stream length exceeded");
|
||||
throw new IllegalStateException("maximum input stream length exceeded");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -41,29 +41,29 @@ public abstract class ICUNotifier {
|
||||
* silently ignored.
|
||||
*/
|
||||
public void addListener(EventListener l) {
|
||||
if (l == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (l == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if (acceptsListener(l)) {
|
||||
synchronized (notifyLock) {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList(5);
|
||||
if (acceptsListener(l)) {
|
||||
synchronized (notifyLock) {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList(5);
|
||||
} else {
|
||||
// identity equality check
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == l) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listeners.add(l);
|
||||
}
|
||||
} else {
|
||||
// identity equality check
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == l) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Listener invalid for this notifier.");
|
||||
}
|
||||
|
||||
listeners.add(l);
|
||||
}
|
||||
} else {
|
||||
throw new InternalError("Listener invalid for this notifier.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,24 +72,24 @@ public abstract class ICUNotifier {
|
||||
* not registered will be silently ignored.
|
||||
*/
|
||||
public void removeListener(EventListener l) {
|
||||
if (l == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
synchronized (notifyLock) {
|
||||
if (listeners != null) {
|
||||
// identity equality check
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == l) {
|
||||
iter.remove();
|
||||
if (listeners.size() == 0) {
|
||||
listeners = null;
|
||||
}
|
||||
return;
|
||||
if (l == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
synchronized (notifyLock) {
|
||||
if (listeners != null) {
|
||||
// identity equality check
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == l) {
|
||||
iter.remove();
|
||||
if (listeners.size() == 0) {
|
||||
listeners = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,64 +98,64 @@ public abstract class ICUNotifier {
|
||||
* is called on each listener from the notification thread.
|
||||
*/
|
||||
public void notifyChanged() {
|
||||
if (listeners != null) {
|
||||
synchronized (notifyLock) {
|
||||
if (listeners != null) {
|
||||
if (notifyThread == null) {
|
||||
notifyThread = new NotifyThread(this);
|
||||
notifyThread.setDaemon(true);
|
||||
notifyThread.start();
|
||||
synchronized (notifyLock) {
|
||||
if (listeners != null) {
|
||||
if (notifyThread == null) {
|
||||
notifyThread = new NotifyThread(this);
|
||||
notifyThread.setDaemon(true);
|
||||
notifyThread.start();
|
||||
}
|
||||
notifyThread.queue(listeners.toArray());
|
||||
}
|
||||
}
|
||||
notifyThread.queue(listeners.toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The notification thread.
|
||||
*/
|
||||
private static class NotifyThread extends Thread {
|
||||
private final ICUNotifier notifier;
|
||||
private final List queue = new LinkedList();
|
||||
private final ICUNotifier notifier;
|
||||
private final List queue = new LinkedList();
|
||||
|
||||
NotifyThread(ICUNotifier notifier) {
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the notification on the thread.
|
||||
*/
|
||||
public void queue(Object[] list) {
|
||||
synchronized (this) {
|
||||
queue.add(list);
|
||||
notify();
|
||||
NotifyThread(ICUNotifier notifier) {
|
||||
this.notifier = notifier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a notification to be queued, then notify all
|
||||
* listeners listed in the notification.
|
||||
*/
|
||||
public void run() {
|
||||
Object[] list;
|
||||
while (true) {
|
||||
try {
|
||||
/**
|
||||
* Queue the notification on the thread.
|
||||
*/
|
||||
public void queue(Object[] list) {
|
||||
synchronized (this) {
|
||||
while (queue.isEmpty()) {
|
||||
wait();
|
||||
}
|
||||
list = (Object[])queue.remove(0);
|
||||
queue.add(list);
|
||||
notify();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.length; ++i) {
|
||||
notifier.notifyListener((EventListener)list[i]);
|
||||
/**
|
||||
* Wait for a notification to be queued, then notify all
|
||||
* listeners listed in the notification.
|
||||
*/
|
||||
public void run() {
|
||||
Object[] list;
|
||||
while (true) {
|
||||
try {
|
||||
synchronized (this) {
|
||||
while (queue.isEmpty()) {
|
||||
wait();
|
||||
}
|
||||
list = (Object[])queue.remove(0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.length; ++i) {
|
||||
notifier.notifyListener((EventListener)list[i]);
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -43,141 +43,141 @@ public class ICURWLock {
|
||||
* Internal class used to gather statistics on the RWLock.
|
||||
*/
|
||||
public final static class Stats {
|
||||
/**
|
||||
* Number of times read access granted (read count).
|
||||
*/
|
||||
public int _rc;
|
||||
/**
|
||||
* Number of times read access granted (read count).
|
||||
*/
|
||||
public int _rc;
|
||||
|
||||
/**
|
||||
* Number of times concurrent read access granted (multiple read count).
|
||||
*/
|
||||
public int _mrc;
|
||||
/**
|
||||
* Number of times concurrent read access granted (multiple read count).
|
||||
*/
|
||||
public int _mrc;
|
||||
|
||||
/**
|
||||
* Number of times blocked for read (waiting reader count).
|
||||
*/
|
||||
public int _wrc; // wait for read
|
||||
/**
|
||||
* Number of times blocked for read (waiting reader count).
|
||||
*/
|
||||
public int _wrc; // wait for read
|
||||
|
||||
/**
|
||||
* Number of times write access granted (writer count).
|
||||
*/
|
||||
public int _wc;
|
||||
/**
|
||||
* Number of times write access granted (writer count).
|
||||
*/
|
||||
public int _wc;
|
||||
|
||||
/**
|
||||
* Number of times blocked for write (waiting writer count).
|
||||
*/
|
||||
public int _wwc;
|
||||
/**
|
||||
* Number of times blocked for write (waiting writer count).
|
||||
*/
|
||||
public int _wwc;
|
||||
|
||||
private Stats() {
|
||||
}
|
||||
private Stats() {
|
||||
}
|
||||
|
||||
private Stats(int rc, int mrc, int wrc, int wc, int wwc) {
|
||||
this._rc = rc;
|
||||
this._mrc = mrc;
|
||||
this._wrc = wrc;
|
||||
this._wc = wc;
|
||||
this._wwc = wwc;
|
||||
}
|
||||
private Stats(int rc, int mrc, int wrc, int wc, int wwc) {
|
||||
this._rc = rc;
|
||||
this._mrc = mrc;
|
||||
this._wrc = wrc;
|
||||
this._wc = wc;
|
||||
this._wwc = wwc;
|
||||
}
|
||||
|
||||
private Stats(Stats rhs) {
|
||||
this(rhs._rc, rhs._mrc, rhs._wrc, rhs._wc, rhs._wwc);
|
||||
}
|
||||
private Stats(Stats rhs) {
|
||||
this(rhs._rc, rhs._mrc, rhs._wrc, rhs._wc, rhs._wwc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string listing all the stats.
|
||||
*/
|
||||
public String toString() {
|
||||
return " rc: " + _rc +
|
||||
" mrc: " + _mrc +
|
||||
" wrc: " + _wrc +
|
||||
" wc: " + _wc +
|
||||
" wwc: " + _wwc;
|
||||
}
|
||||
/**
|
||||
* Return a string listing all the stats.
|
||||
*/
|
||||
public String toString() {
|
||||
return " rc: " + _rc +
|
||||
" mrc: " + _mrc +
|
||||
" wrc: " + _wrc +
|
||||
" wc: " + _wc +
|
||||
" wwc: " + _wwc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the stats. Returns existing stats, if any.
|
||||
*/
|
||||
public synchronized Stats resetStats() {
|
||||
Stats result = stats;
|
||||
stats = new Stats();
|
||||
return result;
|
||||
Stats result = stats;
|
||||
stats = new Stats();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stats (stop collecting stats). Returns existing stats, if any.
|
||||
*/
|
||||
public synchronized Stats clearStats() {
|
||||
Stats result = stats;
|
||||
stats = null;
|
||||
return result;
|
||||
Stats result = stats;
|
||||
stats = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a snapshot of the current stats. This does not reset the stats.
|
||||
*/
|
||||
public synchronized Stats getStats() {
|
||||
return stats == null ? null : new Stats(stats);
|
||||
return stats == null ? null : new Stats(stats);
|
||||
}
|
||||
|
||||
// utilities
|
||||
|
||||
private synchronized boolean gotRead() {
|
||||
++rc;
|
||||
if (stats != null) {
|
||||
++stats._rc;
|
||||
if (rc > 1) ++stats._mrc;
|
||||
}
|
||||
return true;
|
||||
++rc;
|
||||
if (stats != null) {
|
||||
++stats._rc;
|
||||
if (rc > 1) ++stats._mrc;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized boolean getRead() {
|
||||
if (rc >= 0 && wwc == 0) {
|
||||
return gotRead();
|
||||
}
|
||||
++wrc;
|
||||
return false;
|
||||
if (rc >= 0 && wwc == 0) {
|
||||
return gotRead();
|
||||
}
|
||||
++wrc;
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized boolean retryRead() {
|
||||
if (stats != null) ++stats._wrc;
|
||||
if (rc >= 0 && wwc == 0) {
|
||||
--wrc;
|
||||
return gotRead();
|
||||
}
|
||||
return false;
|
||||
if (stats != null) ++stats._wrc;
|
||||
if (rc >= 0 && wwc == 0) {
|
||||
--wrc;
|
||||
return gotRead();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized boolean finishRead() {
|
||||
if (rc > 0) {
|
||||
return (0 == --rc && wwc > 0);
|
||||
}
|
||||
throw new InternalError("no current reader to release");
|
||||
if (rc > 0) {
|
||||
return (0 == --rc && wwc > 0);
|
||||
}
|
||||
throw new IllegalStateException("no current reader to release");
|
||||
}
|
||||
|
||||
private synchronized boolean gotWrite() {
|
||||
rc = -1;
|
||||
if (stats != null) {
|
||||
++stats._wc;
|
||||
}
|
||||
return true;
|
||||
rc = -1;
|
||||
if (stats != null) {
|
||||
++stats._wc;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized boolean getWrite() {
|
||||
if (rc == 0) {
|
||||
return gotWrite();
|
||||
}
|
||||
++wwc;
|
||||
return false;
|
||||
if (rc == 0) {
|
||||
return gotWrite();
|
||||
}
|
||||
++wwc;
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized boolean retryWrite() {
|
||||
if (stats != null) ++stats._wwc;
|
||||
if (rc == 0) {
|
||||
--wwc;
|
||||
return gotWrite();
|
||||
}
|
||||
return false;
|
||||
if (stats != null) ++stats._wwc;
|
||||
if (rc == 0) {
|
||||
--wwc;
|
||||
return gotWrite();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final int NOTIFY_NONE = 0;
|
||||
@ -185,17 +185,17 @@ public class ICURWLock {
|
||||
private static final int NOTIFY_READERS = 2;
|
||||
|
||||
private synchronized int finishWrite() {
|
||||
if (rc < 0) {
|
||||
rc = 0;
|
||||
if (wwc > 0) {
|
||||
return NOTIFY_WRITERS;
|
||||
} else if (wrc > 0) {
|
||||
return NOTIFY_READERS;
|
||||
} else {
|
||||
return NOTIFY_NONE;
|
||||
if (rc < 0) {
|
||||
rc = 0;
|
||||
if (wwc > 0) {
|
||||
return NOTIFY_WRITERS;
|
||||
} else if (wrc > 0) {
|
||||
return NOTIFY_READERS;
|
||||
} else {
|
||||
return NOTIFY_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new InternalError("no current writer to release");
|
||||
throw new IllegalStateException("no current writer to release");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,20 +209,20 @@ public class ICURWLock {
|
||||
* releaseRead when done (for example, in a finally block).</p>
|
||||
*/
|
||||
public void acquireRead() {
|
||||
if (!getRead()) {
|
||||
for (;;) {
|
||||
try {
|
||||
synchronized (readLock) {
|
||||
readLock.wait();
|
||||
}
|
||||
if (retryRead()) {
|
||||
return;
|
||||
if (!getRead()) {
|
||||
for (;;) {
|
||||
try {
|
||||
synchronized (readLock) {
|
||||
readLock.wait();
|
||||
}
|
||||
if (retryRead()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,12 +234,12 @@ public class ICURWLock {
|
||||
* controlled by acquireRead.</p>
|
||||
*/
|
||||
public void releaseRead() {
|
||||
if (finishRead()) {
|
||||
synchronized (writeLock) {
|
||||
writeLock.notify();
|
||||
if (finishRead()) {
|
||||
synchronized (writeLock) {
|
||||
writeLock.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Acquire the write lock, blocking until the write lock is
|
||||
@ -253,20 +253,20 @@ public class ICURWLock {
|
||||
* block).<p>
|
||||
*/
|
||||
public void acquireWrite() {
|
||||
if (!getWrite()) {
|
||||
for (;;) {
|
||||
try {
|
||||
synchronized (writeLock) {
|
||||
writeLock.wait();
|
||||
}
|
||||
if (retryWrite()) {
|
||||
return;
|
||||
if (!getWrite()) {
|
||||
for (;;) {
|
||||
try {
|
||||
synchronized (writeLock) {
|
||||
writeLock.wait();
|
||||
}
|
||||
if (retryWrite()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,19 +279,19 @@ public class ICURWLock {
|
||||
* acquireWrite.</p>
|
||||
*/
|
||||
public void releaseWrite() {
|
||||
switch (finishWrite()) {
|
||||
case NOTIFY_WRITERS:
|
||||
synchronized (writeLock) {
|
||||
writeLock.notify();
|
||||
switch (finishWrite()) {
|
||||
case NOTIFY_WRITERS:
|
||||
synchronized (writeLock) {
|
||||
writeLock.notify();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_READERS:
|
||||
synchronized (readLock) {
|
||||
readLock.notifyAll();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_NONE:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NOTIFY_READERS:
|
||||
synchronized (readLock) {
|
||||
readLock.notifyAll();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
||||
// genrb does not generate Table32 with %%ALIAS
|
||||
return new ResourceTable32(null, rootResource, "", true);
|
||||
} else {
|
||||
throw new InternalError("Invalid format error");
|
||||
throw new IllegalStateException("Invalid format error");
|
||||
}
|
||||
}
|
||||
private ICUResourceBundleImpl(ICUResourceBundleReader reader, String baseName,
|
||||
@ -183,7 +183,7 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
||||
return new ResourceTable(key, resPath, resource);
|
||||
}
|
||||
default :
|
||||
throw new InternalError("The resource type is unknown");
|
||||
throw new IllegalStateException("The resource type is unknown");
|
||||
}
|
||||
//}
|
||||
//return null;
|
||||
@ -703,3 +703,4 @@ public class ICUResourceBundleImpl extends ICUResourceBundle {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -433,7 +433,7 @@ public class ICUService extends ICUNotifier {
|
||||
}
|
||||
}
|
||||
if (startIndex == 0) {
|
||||
throw new InternalError("Factory " + factory + "not registered with service: " + this);
|
||||
throw new IllegalStateException("Factory " + factory + "not registered with service: " + this);
|
||||
}
|
||||
cacheResult = false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1996-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
@ -689,7 +689,7 @@ public class IntTrieBuilder extends TrieBuilder
|
||||
block = allocDataBlock();
|
||||
if (block < 0) {
|
||||
// data table overflow
|
||||
throw new InternalError("Internal error: Out of memory space");
|
||||
throw new IllegalStateException("Internal error: Out of memory space");
|
||||
}
|
||||
fillBlock(block, 0, DATA_BLOCK_LENGTH, m_leadUnitValue_, true);
|
||||
// negative block number to indicate that it is a repeat block
|
||||
@ -788,4 +788,4 @@ public class IntTrieBuilder extends TrieBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2005, international Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, international Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -128,7 +128,7 @@ public class PrettyPrinter {
|
||||
String sresult = target.toString();
|
||||
UnicodeSet doubleCheck = new UnicodeSet(sresult);
|
||||
if (!uset.equals(doubleCheck)) {
|
||||
throw new InternalError("Failure to round-trip in pretty-print");
|
||||
throw new IllegalStateException("Failure to round-trip in pretty-print");
|
||||
}
|
||||
return sresult;
|
||||
}
|
||||
@ -230,4 +230,4 @@ public class PrettyPrinter {
|
||||
// public String toString() {
|
||||
// return target.toString();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2005, International Business Machines
|
||||
* Copyright (c) 2002-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -585,8 +585,8 @@ public final class UPropertyAliases implements ICUBinary.Authenticate {
|
||||
return (short) ((offset < 0) ? -i : i);
|
||||
}
|
||||
}
|
||||
throw new InternalError("Can't map string pool offset " + offset +
|
||||
" to index");
|
||||
throw new IllegalStateException("Can't map string pool offset " +
|
||||
offset + " to index");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,8 +612,8 @@ public final class UPropertyAliases implements ICUBinary.Authenticate {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw new InternalError("Can't map value map offset " + offset +
|
||||
" to index");
|
||||
throw new IllegalStateException("Can't map value map offset " +
|
||||
offset + " to index");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,7 +472,7 @@ public final class Utility {
|
||||
}
|
||||
|
||||
if (ai != length || i != maxI) {
|
||||
throw new InternalError("Bad run-length encoded int array");
|
||||
throw new IllegalStateException("Bad run-length encoded int array");
|
||||
}
|
||||
|
||||
return array;
|
||||
@ -508,7 +508,7 @@ public final class Utility {
|
||||
}
|
||||
|
||||
if (ai != length)
|
||||
throw new InternalError("Bad run-length encoded short array");
|
||||
throw new IllegalStateException("Bad run-length encoded short array");
|
||||
|
||||
return array;
|
||||
}
|
||||
@ -539,7 +539,7 @@ public final class Utility {
|
||||
}
|
||||
|
||||
if (ai != length)
|
||||
throw new InternalError("Bad run-length encoded short array");
|
||||
throw new IllegalStateException("Bad run-length encoded short array");
|
||||
|
||||
return array;
|
||||
}
|
||||
@ -609,10 +609,10 @@ public final class Utility {
|
||||
}
|
||||
|
||||
if (node != 0)
|
||||
throw new InternalError("Bad run-length encoded byte array");
|
||||
throw new IllegalStateException("Bad run-length encoded byte array");
|
||||
|
||||
if (i != s.length())
|
||||
throw new InternalError("Excess data in RLE byte array string");
|
||||
throw new IllegalStateException("Excess data in RLE byte array string");
|
||||
|
||||
return array;
|
||||
}
|
||||
|
@ -1820,8 +1820,8 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
||||
};
|
||||
|
||||
static {
|
||||
if(COUNT!=BLOCKS_.length) {
|
||||
throw new java.lang.InternalError("UnicodeBlock fields are inconsistent!");
|
||||
if (COUNT!=BLOCKS_.length) {
|
||||
throw new java.lang.IllegalStateException("UnicodeBlock fields are inconsistent!");
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -421,7 +421,8 @@ public final class UScript {
|
||||
}
|
||||
|
||||
if (w < result.length) {
|
||||
throw new InternalError("bad locale data, listed " + result.length + " scripts but found only " + w);
|
||||
throw new IllegalStateException("bad locale data, listed " +
|
||||
result.length + " scripts but found only " + w);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -228,7 +228,7 @@ public abstract class BreakIterator implements Cloneable
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
///CLOVER:OFF
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
///CLOVER:ON
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -374,7 +374,7 @@ final class BreakTransliterator extends Transliterator {
|
||||
return other;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2003-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2003-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -41,7 +41,7 @@ final class CollatorServiceShim extends Collator.ServiceShim {
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
///CLOVER:OFF
|
||||
throw new InternalError(e.getMessage());
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
///CLOVER:ON
|
||||
}
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
return other;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
///CLOVER:OFF
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
///CLOVER:ON
|
||||
}
|
||||
}
|
||||
|
@ -2732,7 +2732,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
other.symbols = (DecimalFormatSymbols) symbols.clone();
|
||||
return other;
|
||||
} catch (Exception e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
// other fields are bit-copied
|
||||
} catch (CloneNotSupportedException e) {
|
||||
///CLOVER:OFF
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
///CLOVER:ON
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2000-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -806,7 +806,7 @@ public final class Normalizer implements Cloneable {
|
||||
this.mode = mode;
|
||||
this.options = options;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError(e.toString());
|
||||
throw new IllegalStateException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,7 +832,7 @@ public final class Normalizer implements Cloneable {
|
||||
return copy;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
throw new InternalError(e.toString());
|
||||
throw new IllegalStateException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2104,7 +2104,7 @@ public final class Normalizer implements Cloneable {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new InternalError("Could not create a new UCharacterIterator");
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
@ -2120,7 +2120,7 @@ public final class Normalizer implements Cloneable {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new InternalError("Could not create a new UCharacterIterator");
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
@ -2136,7 +2136,7 @@ public final class Normalizer implements Cloneable {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new InternalError("Could not create a new UCharacterIterator");
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
@ -2152,7 +2152,7 @@ public final class Normalizer implements Cloneable {
|
||||
|
||||
UCharacterIterator newIter = UCharacterIterator.getInstance(newText);
|
||||
if (newIter == null) {
|
||||
throw new InternalError("Could not create a new UCharacterIterator");
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
@ -2168,12 +2168,12 @@ public final class Normalizer implements Cloneable {
|
||||
try{
|
||||
UCharacterIterator newIter = (UCharacterIterator)newText.clone();
|
||||
if (newIter == null) {
|
||||
throw new InternalError("Could not create a new UCharacterIterator");
|
||||
throw new IllegalStateException("Could not create a new UCharacterIterator");
|
||||
}
|
||||
text = newIter;
|
||||
reset();
|
||||
}catch(CloneNotSupportedException e) {
|
||||
throw new InternalError("Could not clone the UCharacterIterator");
|
||||
throw new IllegalStateException("Could not clone the UCharacterIterator");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2003-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2003-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -215,7 +215,7 @@ final class Punycode {
|
||||
* <n,i> state to <m,0>, but guard against overflow:
|
||||
*/
|
||||
if(m-n>(0x7fffffff-MAX_CP_COUNT-delta)/(handledCPCount+1)) {
|
||||
throw new InternalError("Internal program error");
|
||||
throw new IllegalStateException("Internal program error");
|
||||
}
|
||||
delta+=(m-n)*(handledCPCount+1);
|
||||
n=m;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2004-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2004-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -146,7 +146,7 @@ final class RBNFChinesePostProcessor extends RBNFPostProcessor {
|
||||
n = -1;
|
||||
break;
|
||||
default:
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,8 @@ public final class RuleBasedCollator extends Collator
|
||||
CollationRuleParser src = new CollationRuleParser(getRules());
|
||||
return src.getTailoredSet();
|
||||
} catch(Exception e) {
|
||||
throw new InternalError("A tailoring rule should not have errors. Something is quite wrong!");
|
||||
throw new IllegalStateException("A tailoring rule should not " +
|
||||
"have errors. Something is quite wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -273,7 +273,7 @@ public final class StringCharacterIterator implements CharacterIterator
|
||||
return other;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2801,7 +2801,7 @@ public class UnicodeSet extends UnicodeFilter {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InternalError("UnicodeSet.getInclusions(unknown src "+src+")");
|
||||
throw new IllegalStateException("UnicodeSet.getInclusions(unknown src "+src+")");
|
||||
}
|
||||
INCLUSIONS[src] = incl;
|
||||
}
|
||||
|
@ -1553,7 +1553,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable {
|
||||
// todo: fix, difficult to test without subclassing
|
||||
if (fields == null || fields.length < BASE_FIELD_COUNT ||
|
||||
fields.length > MAX_FIELD_COUNT) {
|
||||
throw new InternalError("Invalid fields[]");
|
||||
throw new IllegalStateException("Invalid fields[]");
|
||||
}
|
||||
///CLOVER:ON
|
||||
stamp = new int[fields.length];
|
||||
@ -1685,7 +1685,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable {
|
||||
case JAPANESE:
|
||||
return new JapaneseCalendar(zone, locale);
|
||||
default:
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
} else {
|
||||
Calendar result = factory.create(zone, locale);
|
||||
@ -3814,7 +3814,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable {
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4880,8 +4880,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable {
|
||||
*/
|
||||
protected final void internalSet(int field, int value) {
|
||||
if (((1 << field) & internalSetMask) == 0) {
|
||||
throw new InternalError("Subclass cannot set " +
|
||||
fieldName(field));
|
||||
throw new IllegalStateException("Subclass cannot set " +
|
||||
fieldName(field));
|
||||
}
|
||||
fields[field] = value;
|
||||
stamp[field] = INTERNALLY_SET;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -287,7 +287,7 @@ public final class CompactByteArray implements Cloneable {
|
||||
if (hashes != null) other.hashes = (int[])hashes.clone();
|
||||
return other;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2006, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -311,7 +311,7 @@ public final class CompactCharArray implements Cloneable {
|
||||
if (hashes != null) other.hashes = (int[])hashes.clone();
|
||||
return other;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ public class GlobalizationPreferences implements Freezable {
|
||||
try {
|
||||
return (Collator) collator.clone(); // clone for safety
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError("Error in cloning collator");
|
||||
throw new IllegalStateException("Error in cloning collator");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
other.ID = ID;
|
||||
return other;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ public abstract class UResourceBundle extends ResourceBundle{
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
//this should never happen
|
||||
throw new InternalError();
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
///CLOVER:ON
|
||||
|
Loading…
Reference in New Issue
Block a user