Update of 
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter
In directory 
james.mmbase.org:/tmp/cvs-serv19747/cmsc/richtext/src/java/org/mmbase/applications/wordfilter

Modified Files:
        WordHtmlCleaner.java 
Log Message:
CMSC-907 Code Quality with PMD
PMD error fixes


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter
See also: http://www.mmbase.org/jira/browse/CMSC-907


Index: WordHtmlCleaner.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter/WordHtmlCleaner.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- WordHtmlCleaner.java        26 May 2008 12:17:51 -0000      1.14
+++ WordHtmlCleaner.java        9 Jun 2008 21:23:24 -0000       1.15
@@ -9,9 +9,7 @@
  */
 package org.mmbase.applications.wordfilter;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -27,10 +25,10 @@
  * 
  * @author Nico Klasens (Finalist IT Group)
  */
-public class WordHtmlCleaner {
+public final class WordHtmlCleaner {
 
    /** MMBase logging system */
-   private static Logger log = 
Logging.getLoggerInstance(WordHtmlCleaner.class.getName());
+   private static final Logger log = 
Logging.getLoggerInstance(WordHtmlCleaner.class.getName());
 
    /**
     * xmlbs stuff Document structure configurable using a property file. A
@@ -49,7 +47,7 @@
          String propertiesResource = "WordHtmlCleaner.properties";
          InputStream resourceAsStream = 
WordHtmlCleaner.class.getResourceAsStream(propertiesResource);
          if (resourceAsStream == null) {
-            throw new RuntimeException("resource " + propertiesResource + " is 
not found");
+            throw new IllegalStateException("resource " + propertiesResource + 
" is not found");
          }
          prop.load(resourceAsStream);
          xmlbsDTD = new xmlbs.PropertiesDocumentStructure(prop);
@@ -60,6 +58,9 @@
       }
    }
 
+   private WordHtmlCleaner() {
+      // utility
+   }
 
    public static String cleanXML(String textStr) {
       String xmlVersion = "";
@@ -356,7 +357,7 @@
       int end = 0;
       while ((begin = nextResult(xmlStr, "<a ", end)) > -1) {
          xml += xmlStr.substring(end, begin);
-         int endBegin = xmlStr.indexOf(">", begin);
+         int endBegin = xmlStr.indexOf('>', begin);
          end = nextResult(xmlStr, "</a>", begin);
          if (end > -1 && "".equals(stripHtmlFromBody(xmlStr.substring(endBegin 
+ 1, end)))) {
             String atag = xmlStr.substring(begin, endBegin + 1);
@@ -392,7 +393,7 @@
       while ((begin = nextResult(xmlStr, "<a ", end)) > -1) {
          xml += xmlStr.substring(end, begin);
 
-         int gt = xmlStr.indexOf(">", begin);
+         int gt = xmlStr.indexOf('>', begin);
          int closinggt = xmlStr.indexOf("/>", begin);
          boolean emptyTag = closinggt != -1 && gt >= closinggt + 1;
          if (emptyTag) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to