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

cleanup - use contains instead of indexOf

上级 d8d0d1f9
......@@ -376,10 +376,7 @@ public class ConnectionInfo implements Cloneable {
if (nameNormalized == null) {
if (!SysProperties.IMPLICIT_RELATIVE_PATH) {
if (!FileUtils.isAbsolute(name)) {
if (name.indexOf("./") < 0 &&
name.indexOf(".\\") < 0 &&
name.indexOf(":/") < 0 &&
name.indexOf(":\\") < 0) {
if (!name.contains("./") && !name.contains(".\\") && !name.contains(":/") && !name.contains(":\\")) {
// the name could start with "./", or
// it could start with a prefix such as "nio:./"
// for Windows, the path "\test" is not considered
......
......@@ -930,7 +930,7 @@ public class Session extends SessionWithState {
if (lockMode != Constants.LOCK_MODE_OFF &&
!database.isMultiVersion()) {
TableType tableType = log.getTable().getTableType();
if (locks.indexOf(log.getTable()) < 0
if (!locks.contains(log.getTable())
&& TableType.TABLE_LINK != tableType
&& TableType.EXTERNAL_TABLE_ENGINE != tableType) {
DbException.throwInternalError("" + tableType);
......
......@@ -389,10 +389,8 @@ public class CipherFactory {
private static String[] enableAnonymous(String[] enabled, String[] supported) {
LinkedHashSet<String> set = new LinkedHashSet<>();
for (String x : supported) {
if (!x.startsWith("SSL") &&
x.indexOf("_anon_") >= 0 &&
(x.indexOf("_AES_") >= 0 || x.indexOf("_3DES_") >= 0) &&
x.indexOf("_SHA") >= 0) {
if (!x.startsWith("SSL") && x.contains("_anon_") &&
(x.contains("_AES_") || x.contains("_3DES_")) && x.contains("_SHA")) {
set.add(x);
}
}
......
......@@ -223,7 +223,7 @@ class FileNioMapped extends FileBase {
file.setLength(newLength);
break;
} catch (IOException e) {
if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) {
if (i > 16 || !e.toString().contains("user-mapped section open")) {
throw e;
}
}
......
......@@ -901,7 +901,7 @@ public abstract class Table extends SchemaObjectBase {
* @param constraint the constraint to add
*/
public void addConstraint(Constraint constraint) {
if (constraints == null || constraints.indexOf(constraint) < 0) {
if (constraints == null || !constraints.contains(constraint)) {
constraints = add(constraints, constraint);
}
}
......
......@@ -356,7 +356,7 @@ ShutdownHandler {
System.gc();
// Mac OS X: Console tool process did not stop on exit
String os = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
if (os.indexOf("mac") >= 0) {
if (os.contains("mac")) {
for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().startsWith("AWT-")) {
t.interrupt();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论