From 317aabb6261d54d7f8d811110c1fdf4fa742d44b Mon Sep 17 00:00:00 2001
From: kerry <kerry@finereport.com>
Date: Tue, 20 Jun 2017 14:06:21 +0800
Subject: [PATCH] =?UTF-8?q?REPORT-2354=20=E5=B0=86=E5=B9=B3=E5=8F=B0?=
 =?UTF-8?q?=E7=9A=84=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E5=92=8C=E8=AE=BE?=
 =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=9A=84=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86?=
 =?UTF-8?q?=E7=BB=9F=E4=B8=80=E8=B5=B7=E6=9D=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../fr/design/extra/PluginOperateUtils.java   |  2 +-
 .../design/extra/exe/callback/JSCallback.java | 27 +++++++++----------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java
index 21104b3a7..5b4f44515 100644
--- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java
+++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java
@@ -92,7 +92,7 @@ public class PluginOperateUtils {
                     List<PluginView> plugins = PluginsReaderFromStore.readPluginsForUpdate();
                     JSONArray jsonArray = new JSONArray();
                     for (PluginView plugin : plugins) {
-                        org.json.JSONObject jsonObject = new org.json.JSONObject();
+                        JSONObject jsonObject = new JSONObject();
                         jsonObject.put("pluginid", plugin.getID());
                         jsonArray.put(jsonObject);
                     }
diff --git a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java
index c64bdafad..acb74dd78 100644
--- a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java
+++ b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java
@@ -8,6 +8,9 @@ import javafx.concurrent.Task;
 import javafx.scene.web.WebEngine;
 import netscape.javascript.JSObject;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * Created by ibm on 2017/5/27.
  */
@@ -57,7 +60,7 @@ public class JSCallback<T> extends Task<T> {
      * 这边建议去除所有的html标签
      * 字符\在java中实际存储的是\\,替换字符串\\n, 需要用\\\\n
      * "\t"和"\n" 都要转义成" " 不然会解析出错
-     * "\\"需要转换成"\"
+     * "\\"需要转换成"\\\"
      *  过滤掉html标签及内容
      *
      * @param old 原始字符串
@@ -65,9 +68,8 @@ public class JSCallback<T> extends Task<T> {
      */
     private String trimText(String old) {
         if (StringUtils.isNotBlank(old)) {
-            String a = filterHtmlTag(old, "a");
-            String b = filterHtmlTag(a, "font");
-            return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\");
+            String b = filterHtmlTag(old);
+            return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
         }
         return StringUtils.EMPTY;
     }
@@ -75,21 +77,16 @@ public class JSCallback<T> extends Task<T> {
     /**
      * 进行html标签过滤
      * @param origin 原始字符串
-     * @param tag html标签
      * @return 处理之后的字符串
      */
-    private String filterHtmlTag(String origin, String tag) {
-        String matter1 = "<" + tag;
-        String matter2 = tag + ">";
-        int a = origin.indexOf(matter1);
-        int b = origin.indexOf(matter2);
-        while (a != -1 && b != -1) {
-            origin = origin.substring(0, a) + origin.substring(b + matter2.length(), origin.length());
-            a = origin.indexOf(matter1);
-            b = origin.indexOf(matter2);
-        }
+    private String filterHtmlTag(String origin) {
+        String regEx_html = "<[^>]+>";
+        Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
+        Matcher m_html = p_html.matcher(origin);
+        origin = m_html.replaceAll("");
         return origin;
     }
 
+
 }