-
Notifications
You must be signed in to change notification settings - Fork 55
ANY23-445 Review spotbugs issues #151
base: master
Are you sure you want to change the base?
Conversation
Current branch results in following errors
@HansBrende if you get a chance can you review. You can run spotbugs analysis as follows
You can also get detailed information by running
You can then load the file in ./api/target/spotbugsXml.xml |
@@ -78,6 +78,7 @@ public boolean allExtractorsSupportAllContentTypes() { | |||
return true; | |||
} | |||
|
|||
@SuppressWarnings("unlikely-arg-type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's actually a bug here, so adding @SuppressWarnings
kinda defeats the purpose of the spotbugs plugin. getSupportedMIMETypes()
returns a list of MIMEType
, so checking if it contains a String
will always return false!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed both the SupressWarnings
javac annotation and thought about this one again.
I've decided to introduce <omitVisitors>FindUnrelatedTypesInGenericContainer</omitVisitors>
which will omit spotbugs from identifying this issue as a bug. My justification is that, in this case, because the ExtractorFactory#getSupportedMIMETypes()
supports wildcards, and as far as I can see there is currently no way to determine the full Collection (e.g. */*
) of supported MimeType
's then we cannot enforce another check whether an ExtractorGroup
supports all MimeType
's.
What do you think about this assessment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't clear. The code inside this method has a bug, as correctly identified by the spotbugs plugin. The code is testing if a Collection<MIMEType>
contains a String
. This will always return false, as a String
cannot be an instance of MIMEType
.
Therefore, the method needs to be fixed, and the spotbugs plugin is doing its job correctly: no suppression of warnings is needed here.
@@ -24,8 +24,8 @@ | |||
import java.util.Iterator; | |||
|
|||
/** | |||
* It simple models a group of {@link ExtractorFactory} providing | |||
* simple accessing methods. | |||
* Models a group of {@link ExtractorFactory} objcts providing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
@HansBrende do you have any issue with us pushing this off to the 2.5 development drive? This has blocked the 2.4 release for months and I don't really have the time to invest in addressing it right now. Thanks |
@lewismc I can potentially do a quick fix-up on this PR this weekend when I get a chance, and then we should be good to go. |
First pass at addressing https://issues.apache.org/jira/browse/ANY23-445.
Still loads to do.