Browse Source

Merge pull request #1412 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit '5510686ed5e6c7301127590012efca2792cfb3e4':
  PMD修改
  PMD修改
  变量命名修改
  变量命名修改
  REPORT-5357 插件逻辑中的代码质量(关于使用Executor和线程池)
master
neil 7 years ago
parent
commit
b2a56ce610
  1. 145
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 20
      designer_base/src/com/fr/design/extra/PluginTask.java
  3. 44
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  4. 42
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  5. 75
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  6. 35
      designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java
  7. 51
      designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java
  8. 59
      designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  9. 12
      designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

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

@ -2,7 +2,13 @@ package com.fr.design.extra;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.extra.exe.callback.*; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
import com.fr.design.extra.exe.callback.UpdateOnlineCallback;
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;
@ -20,7 +26,8 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -101,111 +108,25 @@ public class PluginOperateUtils {
}); });
} }
public static void readUpdateOnline(final JSCallback jsCallback) { public static String getRecommendPlugins() {
new Thread(new Runnable() {
@Override
public void run() {
try {
List<PluginView> plugins = PluginsReaderFromStore.readPluginsForUpdate();
JSONArray jsonArray = new JSONArray();
for (PluginView plugin : plugins) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("pluginid", plugin.getID());
jsonArray.put(jsonObject);
}
String result = jsonArray.toString();
jsCallback.execute(result);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}).start();
}
public static void searchPlugin(final String keyword, final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (StringUtils.isBlank(keyword)) {
getRecommendPlugins(jsCallback);
return;
}
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword);
httpClient.asGet();
String result = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.getJSONArray("result");
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray);
jsCallback.execute(resultJSONArray.toString());
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}).start();
}
public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee);
if (getRecommend) {
getRecommendPlugins(jsCallback);
return;
}
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
dealParams(url, category, seller, fee);
try {
HttpClient httpClient = new HttpClient(url.toString());
httpClient.asGet();
String result = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(result);
JSONArray resultArr = resultJSONObject.getJSONArray("result");
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr);
jsCallback.execute(resultJSONArray.toString());
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
} else {
String result = PluginConstants.CONNECTION_404;
jsCallback.execute(result);
}
}
}).start();
}
public static void getRecommendPlugins(JSCallback jsCallback) {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
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);
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
jsCallback.execute(resultJSONArray.toString());
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
return resultArray.toString();
} }
public static void dealParams(StringBuilder url, String category, String seller, String fee) { public static void dealParams(StringBuilder url, String category, String seller, String fee) {
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]) {
@ -216,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)) {
@ -228,44 +149,15 @@ 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);
} }
} }
} }
public static void getPluginCategories(final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
String result;
String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category");
if (url != null) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {
result = PluginConstants.CONNECTION_404;
}
jsCallback.execute(result);
}
}).start();
}
public static void getPluginPrefix(final JSCallback jsCallback) {
new Thread(new Runnable() {
@Override
public void run() {
String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix");
jsCallback.execute(result);
}
}).start();
}
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);
@ -305,5 +197,4 @@ public class PluginOperateUtils {
} }
} }

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

@ -9,6 +9,9 @@ import javafx.concurrent.Task;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* 插件安装,卸载,更新等任务 * 插件安装,卸载,更新等任务
* *
@ -77,8 +80,23 @@ public class PluginTask<T> extends Task<T> {
*/ */
private String trimText(String old) { private String trimText(String old) {
if (StringUtils.isNotBlank(old)) { if (StringUtils.isNotBlank(old)) {
return old.replaceAll("\n", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'"); String b = filterHtmlTag(old);
return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
} }
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
/**
* 进行html标签过滤
* @param origin 原始字符串
* @return 处理之后的字符串
*/
private String filterHtmlTag(String origin) {
String regHtml = "<[^>]+>";
Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE);
Matcher matchHtml = patternHtml.matcher(origin);
origin = matchHtml.replaceAll(StringUtils.EMPTY);
return origin;
}
} }

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

@ -5,8 +5,13 @@ import com.fr.base.FRContext;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
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.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;
@ -23,14 +28,20 @@ import javafx.scene.web.WebEngine;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import java.awt.Desktop;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* 开放给Web组件的接口,用于安装,卸载,更新以及更改插件可用状态 * 开放给Web组件的接口,用于安装,卸载,更新以及更改插件可用状态
@ -48,6 +59,7 @@ public class PluginWebBridge {
private UILabel uiLabel; private UILabel uiLabel;
private ExecutorService threadPoolExecutor = Executors.newSingleThreadExecutor();
/** /**
* 动作枚举 * 动作枚举
@ -222,8 +234,8 @@ public class PluginWebBridge {
* 已安装插件检查更新 * 已安装插件检查更新
*/ */
public void readUpdateOnline(final JSObject callback) { public void readUpdateOnline(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); Task<Void> task = new PluginTask<>(webEngine, callback, new ReadUpdateOnlineExecutor());
PluginOperateUtils.readUpdateOnline(jsCallback); threadPoolExecutor.submit(task);
} }
/** /**
@ -306,8 +318,8 @@ public class PluginWebBridge {
* @param keyword 关键字 * @param keyword 关键字
*/ */
public void searchPlugin(String keyword, final JSObject callback) { public void searchPlugin(String keyword, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); Task<Void> task = new PluginTask<>(webEngine, callback, new SearchOnlineExecutor(keyword));
PluginOperateUtils.searchPlugin(keyword, jsCallback); threadPoolExecutor.submit(task);
} }
/** /**
@ -319,14 +331,14 @@ public class PluginWebBridge {
* @param callback 回调函数 * @param callback 回调函数
*/ */
public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) { public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee));
PluginOperateUtils.getPluginFromStore(category, seller, fee, jsCallback); threadPoolExecutor.submit(task);
} }
public void getPluginPrefix(final JSObject callback) { public void getPluginPrefix(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor());
PluginOperateUtils.getPluginPrefix(jsCallback); threadPoolExecutor.submit(task);
} }
@ -336,8 +348,8 @@ public class PluginWebBridge {
* @param callback 回调函数 * @param callback 回调函数
*/ */
public void getPluginCategories(final JSObject callback) { public void getPluginCategories(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginCategoriesExecutor());
PluginOperateUtils.getPluginCategories(jsCallback); threadPoolExecutor.submit(task);
} }
/** /**
@ -502,7 +514,7 @@ public class PluginWebBridge {
*/ */
public void defaultLogin(String username, String password, final JSObject callback) { public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password)); Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password));
new Thread(task).start(); threadPoolExecutor.submit(task);
} }
/** /**
@ -537,7 +549,7 @@ public class PluginWebBridge {
* 初始化设计器部分 * 初始化设计器部分
*/ */
public void initExtraDiff(final JSObject callback) { public void initExtraDiff(final JSObject callback) {
//todo 初始化设计器其他部分
} }
/** /**

42
designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -0,0 +1,42 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
/**
* Created by vito on 16/5/16.
*/
public class GetPluginCategoriesExecutor implements Executor {
private String result = "[]";
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category");
if (url != null) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {
result = PluginConstants.CONNECTION_404;
}
}
}
};
}
}

75
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -0,0 +1,75 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
* 获取插件分类信息
*/
public class GetPluginFromStoreExecutor implements Executor {
private String result = "[]";
private String category;
private String seller;
private String fee;
public GetPluginFromStoreExecutor(String category, String seller, String fee) {
this.category = category;
this.seller = seller;
this.fee = fee;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee);
if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins();
return;
}
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
PluginOperateUtils.dealParams(url, category, seller, fee);
try {
HttpClient httpClient = new HttpClient(url.toString());
httpClient.asGet();
String responseText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(responseText);
JSONArray resultArr = resultJSONObject.getJSONArray("result");
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr);
result = resultJSONArray.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
} else {
result = PluginConstants.CONNECTION_404;
}
}
}
};
}
}

35
designer_base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java

@ -0,0 +1,35 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
/**
* Created by kerry on 2017/11/3.
*/
public class GetPluginPrefixExecutor implements Executor {
private String result = StringUtils.EMPTY;
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix");
}
}
};
}
}

51
designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

@ -0,0 +1,51 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginsReaderFromStore;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import java.util.List;
/**
* Created by vito on 16/4/19.
*/
public class ReadUpdateOnlineExecutor implements Executor {
private String result = StringUtils.EMPTY;
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
List<PluginView> plugins = PluginsReaderFromStore.readPluginsForUpdate();
JSONArray jsonArray = new JSONArray();
for (PluginView plugin : plugins) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("pluginid", plugin.getID());
jsonArray.put(jsonObject);
}
result = jsonArray.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

59
designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -0,0 +1,59 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
*/
public class SearchOnlineExecutor implements Executor {
private String result = StringUtils.EMPTY;
private String keyword;
public SearchOnlineExecutor(String keyword) {
this.keyword = keyword;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
if (StringUtils.isBlank(keyword)) {
result = PluginOperateUtils.getRecommendPlugins();
return;
}
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword);
httpClient.asGet();
String responseText = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(responseText);
JSONArray jsonArray = jsonObject.getJSONArray("result");
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray);
result = resultJSONArray.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

12
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;
} }
@ -74,14 +74,12 @@ public class JSCallback {
* @return 处理之后的字符串 * @return 处理之后的字符串
*/ */
private String filterHtmlTag(String origin) { private String filterHtmlTag(String origin) {
String regEx_html = "<[^>]+>"; String regHtml = "<[^>]+>";
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(origin); Matcher matchHtml = patternHtml.matcher(origin);
origin = m_html.replaceAll(""); origin = matchHtml.replaceAll(StringUtils.EMPTY);
return origin; return origin;
} }
} }

Loading…
Cancel
Save