Explorar el Código

同步测试环境代码

lideyin hace 5 años
padre
commit
fedac071d7

+ 12 - 0
src/main/java/cn/com/qmth/examcloud/support/handler/richText/AudioTextHandler.java

@@ -4,6 +4,8 @@ import cn.com.qmth.examcloud.support.handler.richText.bean.BlockBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionCollectionBean;
 import com.mysql.cj.util.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -15,8 +17,18 @@ import java.util.List;
  * @Version 1.0
  */
 public class AudioTextHandler implements RichTextHandler{
+    private static Log logger = LogFactory.getLog(HtmlTextHandler.class);
+
     @Override
     public SectionCollectionBean handle(String richText) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("[HTML-TEXT-HANDLER]--richText: " + richText);
+        }
+
+        if (StringUtils.isNullOrEmpty(richText)) {
+            return new SectionCollectionBean();
+        }
+
         SectionCollectionBean sectionCollection = new SectionCollectionBean();
         List<SectionBean> sectionList = new ArrayList<>();
         SectionBean section = new SectionBean();

+ 13 - 0
src/main/java/cn/com/qmth/examcloud/support/handler/richText/ComplexTextHandler.java

@@ -3,6 +3,9 @@ package cn.com.qmth.examcloud.support.handler.richText;
 import cn.com.qmth.examcloud.support.handler.richText.bean.BlockBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionCollectionBean;
+import com.mysql.cj.util.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -18,8 +21,18 @@ import java.util.regex.Pattern;
  * @Version 1.0
  */
 public class ComplexTextHandler implements RichTextHandler {
+    private static Log logger = LogFactory.getLog(HtmlTextHandler.class);
+
     @Override
     public SectionCollectionBean handle(String richText) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("[HTML-TEXT-HANDLER]--richText: " + richText);
+        }
+
+        if (StringUtils.isNullOrEmpty(richText)) {
+            return new SectionCollectionBean();
+        }
+
         SectionCollectionBean body = new SectionCollectionBean();
         List<SectionBean> sections = new ArrayList<>();
         // 得到小题题干或者答案行数

+ 12 - 0
src/main/java/cn/com/qmth/examcloud/support/handler/richText/ImageTextHandler.java

@@ -5,6 +5,8 @@ import cn.com.qmth.examcloud.support.handler.richText.bean.BlockBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionBean;
 import cn.com.qmth.examcloud.support.handler.richText.bean.SectionCollectionBean;
 import com.mysql.cj.util.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -23,8 +25,18 @@ import java.util.Map;
  * @Version 1.0
  */
 public class ImageTextHandler implements RichTextHandler {
+    private static Log logger = LogFactory.getLog(HtmlTextHandler.class);
+
     @Override
     public SectionCollectionBean handle(String richText) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("[HTML-TEXT-HANDLER]--richText: " + richText);
+        }
+
+        if (StringUtils.isNullOrEmpty(richText)) {
+            return new SectionCollectionBean();
+        }
+
         SectionCollectionBean sectionCollection = new SectionCollectionBean();
         List<SectionBean> sectionList = new ArrayList<>();
         SectionBean section = new SectionBean();