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

formatting - add braces to control statements

上级 b81fe715
......@@ -71,8 +71,9 @@ public class DbSchema {
} else if (contents.isPostgreSQL() &&
StringUtils.toUpperEnglish(name).startsWith("PG_")) {
isSystem = true;
} else
} else {
isSystem = contents.isDerby() && name.startsWith("SYS");
}
}
/**
......
......@@ -3569,8 +3569,9 @@ public class Parser {
return b == null;
} else if (a.equals(b)) {
return true;
} else
} else {
return !identifiersToUpper && a.equalsIgnoreCase(b);
}
}
private static boolean equalsTokenIgnoreCase(String a, String b) {
......@@ -3578,8 +3579,9 @@ public class Parser {
return b == null;
} else if (a.equals(b)) {
return true;
} else
} else {
return a.equalsIgnoreCase(b);
}
}
private boolean isTokenInList(Collection<String> upperCaseTokenList) {
......
......@@ -95,8 +95,9 @@ public class DropTable extends SchemaCommand {
}
}
}
if (buff.length() > 0)
if (buff.length() > 0) {
throw DbException.get(ErrorCode.CANNOT_DROP_2, tableName, buff.toString());
}
}
table.lock(session, true, true);
......@@ -142,4 +143,4 @@ public class DropTable extends SchemaCommand {
return CommandInterface.DROP_TABLE;
}
}
\ No newline at end of file
}
......@@ -119,8 +119,9 @@ class AggregateDataMedian extends AggregateData {
count--;
cursor.next();
hasNulls = true;
} else
} else {
break;
}
}
if (count == 0) {
return ValueNull.INSTANCE;
......
......@@ -1648,8 +1648,9 @@ public class Function extends Expression implements FunctionCall {
break;
case SIGNAL: {
String sqlState = v0.getString();
if (sqlState.startsWith("00") || !SIGNAL_PATTERN.matcher(sqlState).matches())
if (sqlState.startsWith("00") || !SIGNAL_PATTERN.matcher(sqlState).matches()) {
throw DbException.getInvalidValueException("SQLSTATE", sqlState);
}
String msgText = v1.getString();
throw DbException.fromUser(sqlState, msgText);
}
......
......@@ -567,8 +567,9 @@ public final class MVStore {
// the following can fail for various reasons
try {
HashMap<String, String> m = DataUtils.parseChecksummedMap(buff);
if (m == null)
if (m == null) {
continue;
}
int blockSize = DataUtils.readHexInt(
m, "blockSize", BLOCK_SIZE);
if (blockSize != BLOCK_SIZE) {
......
......@@ -653,8 +653,9 @@ public class PgServerThread implements Runnable {
case PgServer.PG_TYPE_TIME: {
// Strip timezone offset
int idx = str.indexOf('+');
if (idx <= 0)
if (idx <= 0) {
idx = str.indexOf('-');
}
if (idx > 0) {
str = str.substring(0, idx);
}
......
......@@ -49,8 +49,9 @@ public final class RangeInputStream extends FilterInputStream {
@Override
public int read(byte b[], int off, int len) throws IOException {
if (limit <= 0)
if (limit <= 0) {
return -1;
}
if (len > limit) {
len = (int) limit;
}
......
......@@ -50,8 +50,9 @@ public final class RangeReader extends Reader {
@Override
public int read(char cbuf[], int off, int len) throws IOException {
if (limit <= 0)
if (limit <= 0) {
return -1;
}
if (len > limit) {
len = (int) limit;
}
......
......@@ -720,10 +720,11 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
public static void startWebServer(Connection conn, boolean ignoreProperties) throws SQLException {
WebServer webServer = new WebServer();
String[] args;
if (ignoreProperties)
if (ignoreProperties) {
args = new String[] { "-webPort", "0", "-properties", "null"};
else
} else {
args = new String[] { "-webPort", "0" };
}
Server web = new Server(webServer, args);
web.start();
Server server = new Server();
......
......@@ -422,8 +422,9 @@ public class DateTimeUtils {
*/
private static int findNthIndexOf(String str, char chr, int n) {
int pos = str.indexOf(chr);
while (--n > 0 && pos != -1)
while (--n > 0 && pos != -1) {
pos = str.indexOf(chr, pos + 1);
}
return pos;
}
......
......@@ -57,10 +57,12 @@ public final class MergedResultSet {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null || getClass() != obj.getClass())
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ColumnInfo other = (ColumnInfo) obj;
return name.equals(other.name);
}
......
......@@ -209,12 +209,13 @@ public class SourceCompiler {
if (compiledScript == null) {
String source = sources.get(packageAndClassName);
final String lang;
if (isJavascriptSource(source))
if (isJavascriptSource(source)) {
lang = "javascript";
else if (isRubySource(source))
} else if (isRubySource(source)) {
lang = "ruby";
else
} else {
throw new IllegalStateException("Unknown language for " + source);
}
final Compilable jsEngine = (Compilable) new ScriptEngineManager().getEngineByName(lang);
compiledScript = jsEngine.compile(source);
......
......@@ -534,18 +534,20 @@ public class DataType {
v = ValueBytes.getNoCopy((byte[]) o);
} else if (o != null) {
v = ValueUuid.get((UUID) o);
} else
} else {
v = ValueNull.INSTANCE;
}
break;
}
case Value.UUID: {
Object o = rs.getObject(columnIndex);
if (o instanceof UUID) {
v = ValueUuid.get((UUID) o);
} else if (o != null)
} else if (o != null) {
v = ValueUuid.get((byte[]) o);
else
} else {
v = ValueNull.INSTANCE;
}
break;
}
case Value.BOOLEAN: {
......
......@@ -78,8 +78,9 @@ public class ValueEnum extends ValueEnumBase {
final String cleanLabel = sanitize(value);
for (int i = 0; i < enumerators.length; i++) {
if (cleanLabel.equals(sanitize(enumerators[i])))
if (cleanLabel.equals(sanitize(enumerators[i]))) {
return new ValueEnum(enumerators, i);
}
}
throw DbException.get(ErrorCode.GENERAL_ERROR_1, "Unexpected error");
......@@ -106,7 +107,9 @@ public class ValueEnum extends ValueEnumBase {
}
private static String[] sanitize(final String[] enumerators) {
if (enumerators == null || enumerators.length == 0) return null;
if (enumerators == null || enumerators.length == 0) {
return null;
}
final String[] clean = new String[enumerators.length];
......
......@@ -69,10 +69,11 @@ public class ValueLob extends Value {
* @return the smaller input stream
*/
static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize) {
if (dataSize > 0)
if (dataSize > 0) {
rangeCheck(oneBasedOffset - 1, length, dataSize);
else
} else {
rangeCheckUnknown(oneBasedOffset - 1, length);
}
try {
return new RangeInputStream(inputStream, oneBasedOffset - 1, length);
} catch (IOException e) {
......@@ -90,10 +91,11 @@ public class ValueLob extends Value {
* @return the smaller input stream
*/
static Reader rangeReader(Reader reader, long oneBasedOffset, long length, long dataSize) {
if (dataSize > 0)
if (dataSize > 0) {
rangeCheck(oneBasedOffset - 1, length, dataSize);
else
} else {
rangeCheckUnknown(oneBasedOffset - 1, length);
}
try {
return new RangeReader(reader, oneBasedOffset - 1, length);
} catch (IOException e) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论