[enhance](*): replace with StringBuild (#11146)

This commit is contained in:
jakevin
2022-07-29 14:31:35 +08:00
committed by GitHub
parent e4bc3f6b6f
commit eb4721cd80
9 changed files with 9 additions and 31 deletions

View File

@ -147,7 +147,7 @@ parser code {:
return null;
}
String[] lines = stmt.split("\n", -1);
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append(getErrorTypeMessage(errorToken.sym) + " in line ");
result.append(errorToken.left);
result.append(":\n");

View File

@ -139,7 +139,7 @@ public class AlterPolicyStmt extends DdlStmt {
@Override
public String toSql() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("ALTER POLICY '").append(policyName).append("' ");
sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", true, false)).append(")");
return sb.toString();

View File

@ -77,7 +77,7 @@ public class AlterResourceStmt extends DdlStmt {
@Override
public String toSql() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("ALTER RESOURCE '").append(resourceName).append("' ");
sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", true, false)).append(")");
return sb.toString();

View File

@ -101,7 +101,7 @@ public class Separator implements ParseNode {
// unescape some invisible string literal to char, such as "/t" to char '/t'
private static String unescape(String orig) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
boolean hadSlash = false;
for (int i = 0; i < orig.length(); i++) {
char ch = orig.charAt(i);

View File

@ -431,7 +431,7 @@ public class Replica implements Writable {
@Override
public String toString() {
StringBuffer strBuffer = new StringBuffer("[replicaId=");
StringBuilder strBuffer = new StringBuilder("[replicaId=");
strBuffer.append(id);
strBuffer.append(", BackendId=");
strBuffer.append(backendId);

View File

@ -554,7 +554,7 @@ public class NodeAction extends RestBaseController {
}
private String concatFeSetConfigUrl(NodeConfigs nodeConfigs, boolean isPersist) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
Pair<String, Integer> hostPort = nodeConfigs.getHostPort();
sb.append("http://").append(hostPort.first).append(":").append(hostPort.second).append("/api/_set_config");
Map<String, String> configs = nodeConfigs.getConfigs(isPersist);

View File

@ -17,34 +17,13 @@
package org.apache.doris.httpv2.util;
import com.google.common.base.Strings;
import org.springframework.http.HttpHeaders;
import java.io.BufferedReader;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
public class HttpUtil {
public static boolean isKeepAlive(HttpServletRequest request) {
if (!request.getHeader(HttpHeaders.CONNECTION).equals("close")
&& (request.getProtocol().equals("")
|| request.getHeader(HttpHeaders.CONNECTION).equals("keep-alive"))) {
return true;
}
return false;
}
public static boolean isSslEnable(HttpServletRequest request) {
String url = request.getRequestURL().toString();
if (!Strings.isNullOrEmpty(url) && url.startsWith("https")) {
return true;
}
return false;
}
public static String getBody(HttpServletRequest request) {
StringBuffer data = new StringBuffer();
StringBuilder data = new StringBuilder();
String line = null;
BufferedReader reader = null;
try {

View File

@ -1018,7 +1018,6 @@ public class QueryPlanTest extends TestWithFeService {
public void testJoinPredicateTransitivityWithSubqueryInWhereClause() throws Exception {
connectContext.setDatabase("default_cluster:test");
String sql = "SELECT *\n"
+ "FROM test.pushdown_test\n"
+ "WHERE 0 < (\n"
+ " SELECT MAX(k9)\n" + " FROM test.pushdown_test);";
@ -1037,7 +1036,7 @@ public class QueryPlanTest extends TestWithFeService {
}
@Test
public void testConstInParitionPrune() throws Exception {
public void testConstInPartitionPrune() throws Exception {
FeConstants.runningUnitTest = true;
String queryStr = "explain select * from (select 'aa' as kk1, sum(id) from test.join1 where dt = 9"
+ " group by kk1)tt where kk1 in ('aa');";

View File

@ -81,7 +81,7 @@ public class RepeatNodeTest {
}
@Test
public void testNornal() {
public void testNormal() {
try {
TPlanNode msg = new TPlanNode();
node.toThrift(msg);