Revision: 19641
          http://sourceforge.net/p/gate/code/19641
Author:   markagreenwood
Date:     2016-10-06 07:24:25 +0000 (Thu, 06 Oct 2016)
Log Message:
-----------
removed 15 potential bugs marked as high priority by findbugs

Modified Paths:
--------------
    gate/branches/sawdust2/gate-core/src/main/java/gate/DocumentFormat.java
    gate/branches/sawdust2/gate-core/src/main/java/gate/Utils.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/DocumentStaxUtils.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/AnnotationDiffGUI.java
    gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusEditor.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusQualityAssurance.java
    gate/branches/sawdust2/gate-core/src/main/java/gate/gui/MainFrame.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/ResourceRenderer.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/SerialControllerEditor.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/annedit/SchemaAnnotationEditor.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/AnnotationSetsView.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/DocumentEditor.java
    
gate/branches/sawdust2/gate-core/src/main/java/gate/xml/XmlDocumentHandler.java

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/DocumentFormat.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/DocumentFormat.java     
2016-10-06 06:23:40 UTC (rev 19640)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/DocumentFormat.java     
2016-10-06 07:24:25 UTC (rev 19641)
@@ -316,14 +316,14 @@
     if (aMimeType.hasParameter("Priority"))
       try{
         priority1 =
-              new Integer(aMimeType.getParameterValue("Priority")).intValue();
+              Integer.parseInt(aMimeType.getParameterValue("Priority"));
       }catch (NumberFormatException e){
         return anotherMimeType;
       }
     if (anotherMimeType.hasParameter("Priority"))
       try{
         priority2 =
-          new 
Integer(anotherMimeType.getParameterValue("Priority")).intValue();
+          Integer.parseInt(anotherMimeType.getParameterValue("Priority"));
       }catch (NumberFormatException e){
         return aMimeType;
       }

Modified: gate/branches/sawdust2/gate-core/src/main/java/gate/Utils.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/Utils.java      
2016-10-06 06:23:40 UTC (rev 19640)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/Utils.java      
2016-10-06 07:24:25 UTC (rev 19641)
@@ -923,11 +923,11 @@
    */
   public static String shortenUriString(String uriString, Map<String, String> 
prefixes) {
     // get the URI prefixes 
-    Set<String> namePrefixes = prefixes.keySet();
     String uriPrefix = "";
     String namePrefix = "";
-    for(String np : namePrefixes) {
-      String uri = prefixes.get(np);
+    for(Map.Entry<String,String> entry : prefixes.entrySet()) {
+      String np = entry.getKey();
+      String uri = entry.getValue();
       if(uriString.startsWith(uri)) {
         uriPrefix = uri;
         namePrefix = np;

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/DocumentStaxUtils.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/DocumentStaxUtils.java
  2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/DocumentStaxUtils.java
  2016-10-06 07:24:25 UTC (rev 19641)
@@ -459,7 +459,7 @@
 
       FeatureMap features = readFeatureMap(xsr);
 
-      Relation r = new SimpleRelation(Integer.valueOf(idString), type, 
members);
+      Relation r = new SimpleRelation(Integer.parseInt(idString), type, 
members);
       r.setFeatures(features);
 
       if(stringRep.length() > 0) {

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/AnnotationDiffGUI.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/AnnotationDiffGUI.java  
    2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/AnnotationDiffGUI.java  
    2016-10-06 07:24:25 UTC (rev 19641)
@@ -1277,7 +1277,7 @@
         }
       }
       if (countCopied > 0) {
-        step = String.valueOf(Integer.valueOf(step) + 1);
+        step = String.valueOf(Integer.parseInt(step) + 1);
         keyDoc.getFeatures().put("anndiffsteps", step);
         diffAction.actionPerformed(new ActionEvent(this, -1, "copy"));
         statusLabel.setText(countCopied +

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusEditor.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusEditor.java   
2016-10-06 06:23:40 UTC (rev 19640)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusEditor.java   
2016-10-06 07:24:25 UTC (rev 19641)
@@ -176,16 +176,16 @@
             source = source.replaceFirst("^CorpusEditor\\[", "");
             source = source.replaceFirst("\\]$", "");
             String selectedRows[] = source.split(", ");
-            if (Integer.valueOf(selectedRows[0]) < insertion) { insertion++; }
+            if (Integer.parseInt(selectedRows[0]) < insertion) { insertion++; }
             // get the list of documents selected when dragging started
             for(String row : selectedRows) {
-              if (Integer.valueOf(row) == initialInsertion) {
+              if (Integer.parseInt(row) == initialInsertion) {
                 // the user dragged the selected rows on themselves, do nothing
                 return false;
               }
               documents.add(corpus.get(
-                docTable.rowViewToModel(Integer.valueOf(row))));
-              if (Integer.valueOf(row) < initialInsertion) { insertion--; }
+                docTable.rowViewToModel(Integer.parseInt(row))));
+              if (Integer.parseInt(row) < initialInsertion) { insertion--; }
             }
             // remove the documents selected when dragging started
             for(Document document : documents) {

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusQualityAssurance.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusQualityAssurance.java
 2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/CorpusQualityAssurance.java
 2016-10-06 07:24:25 UTC (rev 19641)
@@ -1347,7 +1347,7 @@
       int sum = 0;
       for (int row = 0; row < tableModel.getRowCount()-1; row++) {
         try {
-          sum += Integer.valueOf((String) tableModel.getValueAt(row, col));
+          sum += Integer.parseInt((String) tableModel.getValueAt(row, col));
         } catch(NumberFormatException e) {
           // do nothing
         }

Modified: gate/branches/sawdust2/gate-core/src/main/java/gate/gui/MainFrame.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/gui/MainFrame.java      
2016-10-06 06:23:40 UTC (rev 19640)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/gui/MainFrame.java      
2016-10-06 07:24:25 UTC (rev 19641)
@@ -1920,7 +1920,7 @@
       Matcher m = START_RUNNING_PATTERN.matcher(text);
       if (m.matches()) {
         // get the corpus size from the status text
-        final int corpusSize = Integer.valueOf(m.group(1));
+        final int corpusSize = Integer.parseInt(m.group(1));
         SwingUtilities.invokeLater(new Runnable() { @Override
         public void run() {
           // initialise the progress bar

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/ResourceRenderer.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/ResourceRenderer.java   
    2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/ResourceRenderer.java   
    2016-10-06 07:24:25 UTC (rev 19641)
@@ -147,7 +147,7 @@
     }
     if(rData != null) {
       toolTipText = "<HTML>Type: <b>" + rData.getName() + "</b></HTML>";
-      String iconName = rData.getIcon();
+      /*String iconName = rData.getIcon();
       if(iconName == null) {
         if(value instanceof LanguageResource)
           iconName = "lr";
@@ -155,7 +155,8 @@
           iconName = "pr";
         else if(value instanceof Controller) iconName = "application";
       }
-      icon = (iconName == null) ? null : MainFrame.getIcon(iconName);
+      icon = (iconName == null) ? null : MainFrame.getIcon(iconName);*/
+      icon = MainFrame.getIcon(rData.getIcon());
     }
     else {
       icon = null;

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/SerialControllerEditor.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/SerialControllerEditor.java
 2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/SerialControllerEditor.java
 2016-10-06 07:24:25 UTC (rev 19641)
@@ -791,17 +791,17 @@
             source = source.replaceFirst("^memberPRsTable\\[", "");
             source = source.replaceFirst("\\]$", "");
             String selectedRows[] = source.split(", ");
-            if (Integer.valueOf(selectedRows[0]) < insertion) { insertion++; }
+            if (Integer.parseInt(selectedRows[0]) < insertion) { insertion++; }
             // get the list of PRs selected when dragging started
             for(String row : selectedRows) {
-              if (Integer.valueOf(row) == initialInsertion) {
+              if (Integer.parseInt(row) == initialInsertion) {
                 // the user draged the selected rows on themselves, do nothing
                 return false;
               }
               prs.add((ProcessingResource) memberPRsTable.getValueAt(
-                Integer.valueOf(row),
+                Integer.parseInt(row),
                 memberPRsTable.convertColumnIndexToView(1)));
-              if (Integer.valueOf(row) < initialInsertion) { insertion--; }
+              if (Integer.parseInt(row) < initialInsertion) { insertion--; }
             }
             // remove the PRs selected when dragging started
             for (ProcessingResource pr : prs) {

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/annedit/SchemaAnnotationEditor.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/annedit/SchemaAnnotationEditor.java
 2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/annedit/SchemaAnnotationEditor.java
 2016-10-06 07:24:25 UTC (rev 19641)
@@ -188,7 +188,7 @@
     // we need to check that:
     // 1) all required features have values
     // 2) all features known by schema that have values, comply with the schema
-    if(annotation == null) return true;
+
     AnnotationSchema aSchema = schemasByType.get(annotation.getType());
     if(aSchema.getFeatureSchemaSet() == null
         || aSchema.getFeatureSchemaSet().isEmpty()) {

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/AnnotationSetsView.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/AnnotationSetsView.java
     2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/AnnotationSetsView.java
     2016-10-06 07:24:25 UTC (rev 19641)
@@ -390,7 +390,7 @@
       Gate.getUserConfig().put(
         AnnotationSetsView.class.getName()+".colours", colourMap);
     } else {
-      colour = new Color(Integer.valueOf(colourValue), true);
+      colour = new Color(Integer.parseInt(colourValue), true);
     }
     
     return colour;

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/DocumentEditor.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/DocumentEditor.java
 2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/gui/docview/DocumentEditor.java
 2016-10-06 07:24:25 UTC (rev 19641)
@@ -1232,7 +1232,8 @@
         int index = e.getMessage().indexOf(" near index ");
         if(index != -1) {
           index += " near index ".length();
-          patternTextField.setCaretPosition(Integer.valueOf(e.getMessage()
+          //TODO does this work when the positon in the regex isn't a single 
digit
+          patternTextField.setCaretPosition(Integer.parseInt(e.getMessage()
               .substring(index, index + 1)));
         }
         patternTextField.requestFocusInWindow();

Modified: 
gate/branches/sawdust2/gate-core/src/main/java/gate/xml/XmlDocumentHandler.java
===================================================================
--- 
gate/branches/sawdust2/gate-core/src/main/java/gate/xml/XmlDocumentHandler.java 
    2016-10-06 06:23:40 UTC (rev 19640)
+++ 
gate/branches/sawdust2/gate-core/src/main/java/gate/xml/XmlDocumentHandler.java 
    2016-10-06 07:24:25 UTC (rev 19641)
@@ -308,7 +308,7 @@
           customObjectId = new Integer(attValue);
         }// End if
         if ("annotMaxId".equals(attName)) {
-          customObjectsId = new Integer(attValue).intValue();
+          customObjectsId = Integer.parseInt(attValue);
         }// End if
         if ("matches".equals(attName)) {
           StringTokenizer strTokenizer = new StringTokenizer(attValue, ";");

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to