提交 12c3cf9a authored 作者: Thomas Mueller's avatar Thomas Mueller

Don't throw Error

上级 2bc833a3
......@@ -69,7 +69,7 @@ public class Bnf {
private RuleHead addRule(String topic, String section, Rule rule) {
RuleHead head = new RuleHead(section, topic, rule);
if (ruleMap.get(StringUtils.toLowerEnglish(topic)) != null) {
throw new Error("already exists: " + topic);
throw new AssertionError("already exists: " + topic);
}
ruleMap.put(StringUtils.toLowerEnglish(topic), head);
return head;
......@@ -206,13 +206,13 @@ public class Bnf {
Rule r2 = parseOr();
r = new RuleOptional(r2);
if (firstChar != ']') {
throw new Error("expected ], got " + currentToken + " syntax:" + syntax);
throw new AssertionError("expected ], got " + currentToken + " syntax:" + syntax);
}
} else if (firstChar == '{') {
read();
r = parseOr();
if (firstChar != '}') {
throw new Error("expected }, got " + currentToken + " syntax:" + syntax);
throw new AssertionError("expected }, got " + currentToken + " syntax:" + syntax);
}
} else if ("@commaDots@".equals(currentToken)) {
r = new RuleList(new RuleElement(",", currentTopic), lastRepeat, false);
......
......@@ -40,7 +40,7 @@ public class RuleElement implements Rule {
if (link != null) {
return link.random(config, level + 1);
}
throw new Error(name);
throw new AssertionError(name);
}
public String name() {
......@@ -76,7 +76,7 @@ public class RuleElement implements Rule {
return;
}
}
throw new Error("Unknown " + name + "/" + test);
throw new AssertionError("Unknown " + name + "/" + test);
}
public boolean matchRemove(Sentence sentence) {
......
......@@ -55,7 +55,7 @@ public class RuleFixed implements Rule {
case DIGIT:
return "0";
default:
throw new Error("type="+type);
throw new AssertionError("type="+type);
}
}
......@@ -92,7 +92,7 @@ public class RuleFixed implements Rule {
case DIGIT:
return "" + (char) ('0' + r.nextInt(10));
default:
throw new Error("type="+type);
throw new AssertionError("type="+type);
}
}
......@@ -213,7 +213,7 @@ public class RuleFixed implements Rule {
}
break;
default:
throw new Error("type=" + type);
throw new AssertionError("type=" + type);
}
if (s.equals(query)) {
return false;
......@@ -292,7 +292,7 @@ public class RuleFixed implements Rule {
}
break;
default:
throw new Error("type="+type);
throw new AssertionError("type="+type);
}
}
......
......@@ -58,7 +58,7 @@ public class RuleList implements Rule {
if (level > 10) {
if (level > 1000) {
// better than stack overflow
throw new Error();
throw new AssertionError();
}
return get(0).random(config, level);
}
......
......@@ -16,7 +16,7 @@ import java.sql.SQLException;
*/
public class JdbcBatchUpdateException extends BatchUpdateException {
private static final long serialVersionUID = 9006432914018679675L;
private static final long serialVersionUID = 1L;
/**
* INTERNAL
......
......@@ -17,7 +17,7 @@ import org.h2.engine.Constants;
*/
public class JdbcSQLException extends SQLException {
private static final long serialVersionUID = -8200821788226954151L;
private static final long serialVersionUID = 1L;
private final String originalMessage;
private final Throwable cause;
private final String stackTrace;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论