Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1091

Fixing issues found via FindBugs and warnings found via IDE

    XMLWordPrintableJSON

    Details

      Description

      There are several issues that can be found using FindBugs.

      mvn clean install findbugs:findbugs findbugs:gui
      

      The opennlp-tools is the only project with issues. Some are mere cosmetics, or not so important. The pull request mentioned in this issue does not fix all issues found, only the ones that I thought would be more important, and that would not have huge impact in the code (i.e. would not have to change much of the current behaviour/code base).

      Some changes are quite useful, such as optimizations that replace string concatenation and use Map#entrySet instead of Map#keySet + another call to Map#get. All the optimizations changes put together, I expect we should see at least a few milliseconds improvement.

      Other changes are quite important, such as comparisons with Object.equals(anArray, anotherArray), which will compare two objects with ==, meaning that even when the arrays are equals, it would still return false.

      In the pull request, I intentionally did not squash it now, as the second commit include warnings found via the IDE (Eclipse in this case, but I believe it's independent of the IDE). Such as suppressWarnings that are not necessary, and - the most importants - resource leak.

      This latter issue was fixed with Java8 try-with-resources, mainly in tests, but also in some tools.

      Cheers
      Bruno

        Attachments

          Activity

            People

            • Assignee:
              kinow Bruno P. Kinoshita
              Reporter:
              kinow Bruno P. Kinoshita
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: