Bruno P. Kinoshita created OPENNLP-1091:
-------------------------------------------

             Summary: Fixing issues found via FindBugs and warnings found via 
IDE
                 Key: OPENNLP-1091
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1091
             Project: OpenNLP
          Issue Type: Improvement
    Affects Versions: 1.8.0
            Reporter: Bruno P. Kinoshita
            Assignee: Bruno P. Kinoshita
            Priority: Minor


There are several issues that can be found using *FindBugs*.

{noformat}
mvn clean install findbugs:findbugs findbugs:gui
{noformat}

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



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to