You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by mb...@apache.org on 2008/02/13 16:12:42 UTC

svn commit: r627454 - in /incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex: extension/impl/CreditCardNumberValidator.java impl/RegExAnnotator.java impl/Rule_impl.java

Author: mbaessler
Date: Wed Feb 13 07:12:38 2008
New Revision: 627454

URL: http://svn.apache.org/viewvc?rev=627454&view=rev
Log:
UIMA-776

fix Findbugs issues

https://issues.apache.org/jira/browse/UIMA-776

Modified:
    incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/extension/impl/CreditCardNumberValidator.java
    incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java
    incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/Rule_impl.java

Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/extension/impl/CreditCardNumberValidator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/extension/impl/CreditCardNumberValidator.java?rev=627454&r1=627453&r2=627454&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/extension/impl/CreditCardNumberValidator.java (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/extension/impl/CreditCardNumberValidator.java Wed Feb 13 07:12:38 2008
@@ -45,7 +45,7 @@
       if (ruleID != null && ruleID.equals("unknown")) {
 
          // check AmericanExpress
-         if ((coveredText.startsWith("34") | coveredText.startsWith("37"))
+         if ((coveredText.startsWith("34") || coveredText.startsWith("37"))
                && coveredText.length() == 15) {
             // already detected by the AmericanExpress pattern
             return false;

Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java?rev=627454&r1=627453&r2=627454&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java Wed Feb 13 07:12:38 2008
@@ -86,8 +86,6 @@
          throws ResourceInitializationException {
       super.initialize(aContext);
 
-      String[] conceptFileNames = new String[] {};
-
       // initialize annotator logger
       this.logger = getContext().getLogger();
 
@@ -96,7 +94,7 @@
 
       // get configuration parameter settings
       // get parameter ConceptFiles, default is an empty array
-      conceptFileNames = safeGetConfigParameterStringArrayValue(getContext(),
+      String[] conceptFileNames = safeGetConfigParameterStringArrayValue(getContext(),
             REGEX_CONCEPTS_FILES, new String[] {});
 
       // get UIMA datapath and tokenize it into its elements
@@ -162,12 +160,9 @@
       }
 
       // initialize the regex concepts
-      if (this.regexConcepts != null) {
-         for (int i = 0; i < this.regexConcepts.length; i++) {
+     for (int i = 0; i < this.regexConcepts.length; i++) {
             ((Concept_impl) this.regexConcepts[i]).initialize(this.logger);
          }
-      }
-
    }
 
    /**
@@ -636,7 +631,7 @@
                throw new RegexAnnotatorProcessException(
                      "regex_annotator_error_validating_annotation",
                      new Object[] { annotations[a].getId(), matchText,
-                           new Integer(localStart), new Integer(localEnd) }, ex);
+                           Integer.valueOf(localStart), Integer.valueOf(localEnd) }, ex);
             }
          }
 
@@ -923,7 +918,7 @@
     * Helper class to bundle the XML Concept file name and the concept file
     * input stream to one object.
     */
-   private class ConceptFile {
+   private static class ConceptFile {
       // concept file path name
       private String filePath;
 

Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/Rule_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/Rule_impl.java?rev=627454&r1=627453&r2=627454&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/Rule_impl.java (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/Rule_impl.java Wed Feb 13 07:12:38 2008
@@ -408,7 +408,7 @@
          }
          String matchGroupName = this.regex.substring(varStart, varEnd);
          // add first match group content (match group name) to the variable list
-         this.matchGroupNames.put(matchGroupName.toLowerCase(), new Integer(
+         this.matchGroupNames.put(matchGroupName.toLowerCase(), Integer.valueOf(
                groupCounter));
          // store match group name with original case
          names.add(matchGroupName);