提交 d8d0d1f9 authored 作者: Jacek Ławrynowicz's avatar Jacek Ławrynowicz

cleanup - avoid checking for null before instanceof

上级 ba4c7216
...@@ -456,7 +456,7 @@ public class ConnectionInfo implements Cloneable { ...@@ -456,7 +456,7 @@ public class ConnectionInfo implements Cloneable {
*/ */
String getProperty(String key) { String getProperty(String key) {
Object value = prop.get(key); Object value = prop.get(key);
if (value == null || !(value instanceof String)) { if (!(value instanceof String)) {
return null; return null;
} }
return value.toString(); return value.toString();
......
...@@ -85,7 +85,7 @@ public class Parameter extends Expression implements ParameterInterface { ...@@ -85,7 +85,7 @@ public class Parameter extends Expression implements ParameterInterface {
@Override @Override
public Expression optimize(Session session) { public Expression optimize(Session session) {
if (session.getDatabase().getMode().treatEmptyStringsAsNull) { if (session.getDatabase().getMode().treatEmptyStringsAsNull) {
if (value != null && value instanceof ValueString) { if (value instanceof ValueString) {
value = ValueString.get(value.getString(), true); value = ValueString.get(value.getString(), true);
} }
} }
......
...@@ -814,7 +814,7 @@ public class MetaTable extends Table { ...@@ -814,7 +814,7 @@ public class MetaTable extends Table {
// reduce the number of tables to scan - makes some metadata queries // reduce the number of tables to scan - makes some metadata queries
// 10x faster // 10x faster
final ArrayList<Table> tablesToList; final ArrayList<Table> tablesToList;
if (indexFrom != null && indexTo != null && indexFrom.equals(indexTo)) { if (indexFrom != null && indexFrom.equals(indexTo)) {
String tableName = identifier(indexFrom.getString()); String tableName = identifier(indexFrom.getString());
tablesToList = getTablesByName(session, tableName); tablesToList = getTablesByName(session, tableName);
} else { } else {
...@@ -895,7 +895,7 @@ public class MetaTable extends Table { ...@@ -895,7 +895,7 @@ public class MetaTable extends Table {
// reduce the number of tables to scan - makes some metadata queries // reduce the number of tables to scan - makes some metadata queries
// 10x faster // 10x faster
final ArrayList<Table> tablesToList; final ArrayList<Table> tablesToList;
if (indexFrom != null && indexTo != null && indexFrom.equals(indexTo)) { if (indexFrom != null && indexFrom.equals(indexTo)) {
String tableName = identifier(indexFrom.getString()); String tableName = identifier(indexFrom.getString());
tablesToList = getTablesByName(session, tableName); tablesToList = getTablesByName(session, tableName);
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论