Browse Source

PMD修改

master
kerry 7 years ago
parent
commit
07e4900daf
  1. 19
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 2
      designer_base/src/com/fr/design/extra/PluginTask.java
  3. 6
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  4. 2
      designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java
  5. 4
      designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

19
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -112,7 +112,7 @@ public class PluginOperateUtils {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
JSONArray resultArray = JSONArray.create(); JSONArray resultArray = JSONArray.create();
try { try {
HttpClient httpClient = new HttpClient(plistUrl.toString()); HttpClient httpClient = new HttpClient(plistUrl);
String result = httpClient.getResponseText(); String result = httpClient.getResponseText();
JSONArray jsonArray = new JSONArray(result); JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
@ -126,7 +126,7 @@ public class PluginOperateUtils {
if (StringUtils.isNotBlank(category)) { if (StringUtils.isNotBlank(category)) {
url.append("cid=").append(category.split("-")[1]); url.append("cid=").append(category.split("-")[1]);
} else { } else {
url.append("cid=").append(""); url.append("cid=").append(StringUtils.EMPTY);
} }
if (StringUtils.isNotBlank(seller)) { if (StringUtils.isNotBlank(seller)) {
switch (seller.split("-")[1]) { switch (seller.split("-")[1]) {
@ -137,7 +137,7 @@ public class PluginOperateUtils {
url.append("&seller=").append(2); url.append("&seller=").append(2);
break; break;
default: default:
url.append("&seller=").append(""); url.append("&seller=").append(StringUtils.EMPTY);
} }
} }
if (StringUtils.isNotBlank(fee)) { if (StringUtils.isNotBlank(fee)) {
@ -149,7 +149,7 @@ public class PluginOperateUtils {
url.append("&fee=").append(2); url.append("&fee=").append(2);
break; break;
default: default:
url.append("&fee=").append(""); url.append("&fee=").append(StringUtils.EMPTY);
} }
} }
} }
@ -157,11 +157,11 @@ public class PluginOperateUtils {
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
String username = ConfigManager.getProviderInstance().getBbsUsername(); String username = ConfigManager.getProviderInstance().getBbsUsername();
if (StringUtils.isEmpty(username)) { if (StringUtils.isEmpty(username)) {
jsCallback.execute(""); jsCallback.execute(StringUtils.EMPTY);
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} else { } else {
uiLabel.setText(username); uiLabel.setText(username);
String result = username; String result = username;
jsCallback.execute(result); jsCallback.execute(result);
} }
} }
@ -177,11 +177,11 @@ public class PluginOperateUtils {
StringBuilder pluginInfo = new StringBuilder(); StringBuilder pluginInfo = new StringBuilder();
List<PluginTaskResult> pluginTaskResults = result.asList(); List<PluginTaskResult> pluginTaskResults = result.asList();
for (PluginTaskResult pluginTaskResult : pluginTaskResults) { for (PluginTaskResult pluginTaskResult : pluginTaskResults) {
if(pluginInfo.length() != 0){ if (pluginInfo.length() != 0) {
pluginInfo.append("\n"); pluginInfo.append("\n");
} }
PluginTask pluginTask = pluginTaskResult.getCurrentTask(); PluginTask pluginTask = pluginTaskResult.getCurrentTask();
if(pluginTask == null){ if (pluginTask == null) {
pluginInfo.append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); pluginInfo.append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
continue; continue;
} }
@ -189,7 +189,7 @@ public class PluginOperateUtils {
PluginContext pluginContext = PluginManager.getContext(pluginMarker); PluginContext pluginContext = PluginManager.getContext(pluginMarker);
if (pluginContext != null) { if (pluginContext != null) {
pluginInfo.append(pluginContext.getName()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); pluginInfo.append(pluginContext.getName()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
}else{ } else {
pluginInfo.append(pluginMarker.getPluginID()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); pluginInfo.append(pluginMarker.getPluginID()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
} }
} }
@ -197,5 +197,4 @@ public class PluginOperateUtils {
} }
} }

2
designer_base/src/com/fr/design/extra/PluginTask.java

@ -95,7 +95,7 @@ public class PluginTask<T> extends Task<T> {
String regHtml = "<[^>]+>"; String regHtml = "<[^>]+>";
Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE);
Matcher matchHtml = patternHtml.matcher(origin); Matcher matchHtml = patternHtml.matcher(origin);
origin = matchHtml.replaceAll(""); origin = matchHtml.replaceAll(StringUtils.EMPTY);
return origin; return origin;
} }

6
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -11,7 +11,7 @@ import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor; import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.extra.exe.getPluginPrefixExecutor; import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -337,7 +337,7 @@ public class PluginWebBridge {
public void getPluginPrefix(final JSObject callback) { public void getPluginPrefix(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new getPluginPrefixExecutor()); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor());
threadPoolExecutor.submit(task); threadPoolExecutor.submit(task);
} }
@ -549,7 +549,7 @@ public class PluginWebBridge {
* 初始化设计器部分 * 初始化设计器部分
*/ */
public void initExtraDiff(final JSObject callback) { public void initExtraDiff(final JSObject callback) {
//todo 初始化设计器其他部分
} }
/** /**

2
designer_base/src/com/fr/design/extra/exe/getPluginPrefixExecutor.java → designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java

@ -7,7 +7,7 @@ import com.fr.stable.StringUtils;
/** /**
* Created by kerry on 2017/11/3. * Created by kerry on 2017/11/3.
*/ */
public class getPluginPrefixExecutor implements Executor { public class GetPluginPrefixExecutor implements Executor {
private String result = StringUtils.EMPTY; private String result = StringUtils.EMPTY;
@Override @Override

4
designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

@ -63,7 +63,7 @@ public class JSCallback {
private String trimText(String old) { private String trimText(String old) {
if (StringUtils.isNotBlank(old)) { if (StringUtils.isNotBlank(old)) {
String b = filterHtmlTag(old); String b = filterHtmlTag(old);
return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
} }
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
@ -77,7 +77,7 @@ public class JSCallback {
String regHtml = "<[^>]+>"; String regHtml = "<[^>]+>";
Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE);
Matcher matchHtml = patternHtml.matcher(origin); Matcher matchHtml = patternHtml.matcher(origin);
origin = matchHtml.replaceAll(""); origin = matchHtml.replaceAll(StringUtils.EMPTY);
return origin; return origin;
} }

Loading…
Cancel
Save