From 769b0537f1a01636f80d10084a7e80ccd396c421 Mon Sep 17 00:00:00 2001 From: lamber-ken Date: Wed, 4 Dec 2019 20:18:37 +0800 Subject: [PATCH] [checkstyle] optimize java code checkstyle for LeftCurly rule (#1375) --- .../ServiceModelToSwagger2MapperImpl.java | 3 +-- .../api/controller/ResourcesController.java | 3 +-- .../api/utils/FourLetterWordMain.java | 6 ++---- .../common/enums/ExecutionStatus.java | 4 +++- .../common/zk/AbstractZKClient.java | 8 +++++-- .../common/queue/TaskQueueImplTest.java | 3 +-- .../dolphinscheduler/dao/TaskRecordDao.java | 3 +-- style/checkstyle.xml | 21 +++++++++++++------ 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java index c0ceb66323..d454b8d312 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java @@ -156,8 +156,7 @@ public class ServiceModelToSwagger2MapperImpl extends ServiceModelToSwagger2Mapp List list = new ArrayList(tagsSet.size()); Iterator it = from.getTags().iterator(); - while(it.hasNext()) - { + while(it.hasNext()){ String tag = it.next(); list.add(StringUtils.isNotBlank(tag) ? messageSource.getMessage(tag, null, tag, locale) : " "); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java index 07d235d802..c132045b73 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java @@ -451,8 +451,7 @@ public class ResourcesController extends BaseController{ @GetMapping(value = "/udf-func/update-ui") @ResponseStatus(HttpStatus.OK) public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("id") int id) - { + @RequestParam("id") int id) { logger.info("login user {}, query udf{}", loginUser.getUserName(), id); try { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java index f946afdae2..d41830eff5 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java @@ -45,8 +45,7 @@ public class FourLetterWordMain { * @throws java.io.IOException io exceptions */ public static String send4LetterWord(String host, int port, String cmd) - throws IOException - { + throws IOException { return send4LetterWord(host, port, cmd, DEFAULT_SOCKET_TIMEOUT); } /** @@ -59,8 +58,7 @@ public class FourLetterWordMain { * @throws java.io.IOException io exceptions */ public static String send4LetterWord(String host, int port, String cmd, int timeout) - throws IOException - { + throws IOException { LOG.info("connecting to " + host + " " + port); Socket sock = new Socket(); InetSocketAddress hostaddress= host != null ? new InetSocketAddress(host, port) : diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java index 5a045eae0b..e86991f359 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java @@ -119,7 +119,9 @@ public enum ExecutionStatus { * status is cancel * @return status */ - public boolean typeIsCancel(){ return this == KILL || this == STOP ;} + public boolean typeIsCancel(){ + return this == KILL || this == STOP ; + } } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java index 142e4bde67..f2861ecc7e 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java @@ -419,13 +419,17 @@ public abstract class AbstractZKClient { * * @return get worker node parent path */ - protected String getWorkerZNodeParentPath(){return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS);}; + protected String getWorkerZNodeParentPath(){ + return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS); + } /** * * @return get master node parent path */ - protected String getMasterZNodeParentPath(){return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS);} + protected String getMasterZNodeParentPath(){ + return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS); + } /** * diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java index 18812331d5..efee627676 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java @@ -94,8 +94,7 @@ public class TaskQueueImplTest extends StandaloneZKServerForTest { public void extremeTest(){ int total = 30 * 10000; - for(int i = 0; i < total; i++) - { + for(int i = 0; i < total; i++) { for(int j = 0; j < total; j++) { //${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId} //format ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId} diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java index e79fc3900f..e32dea1820 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java @@ -93,8 +93,7 @@ public class TaskRecordDao { * @param filterMap filterMap * @return sql string */ - private static String getWhereString(Map filterMap) - { + private static String getWhereString(Map filterMap) { if(filterMap.size() ==0){ return ""; } diff --git a/style/checkstyle.xml b/style/checkstyle.xml index 4201ce8121..54188c6834 100644 --- a/style/checkstyle.xml +++ b/style/checkstyle.xml @@ -37,16 +37,25 @@ + + + - - - + + + - + + + - + + + - + + +