You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pa...@apache.org on 2017/04/19 16:25:39 UTC
[4/6] [lang] Exclude SF_SWITCH_NO_DEFAULT on FastDateParser
Exclude SF_SWITCH_NO_DEFAULT on FastDateParser
FastDateParser#simpleQuote uses a switch case that actually has a
default branch in it, but doesn't use break statements.
SF_SWITCH_NO_DEFAULT unfortunately cannot recognize this pattern, and
leave us with no choice but to suppress it.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c40dcf65
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c40dcf65
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c40dcf65
Branch: refs/heads/master
Commit: c40dcf659897edb26affa408c3fa62e80f906550
Parents: 3304965
Author: Allon Mureinik <am...@redhat.com>
Authored: Sat Apr 1 12:18:53 2017 +0300
Committer: pascalschumacher <pa...@gmx.net>
Committed: Wed Apr 19 18:24:57 2017 +0200
----------------------------------------------------------------------
findbugs-exclude-filter.xml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c40dcf65/findbugs-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
index f7623df..772052a 100644
--- a/findbugs-exclude-filter.xml
+++ b/findbugs-exclude-filter.xml
@@ -139,9 +139,14 @@
<Method name="insertFormats" />
<Bug pattern="SF_SWITCH_NO_DEFAULT" />
</Match>
+ <!-- Reason: FindBugs does not correctly recognize default branches in switch statements without break statements.
+ See, e.g., the report at https://sourceforge.net/p/findbugs/bugs/1298 -->
<Match>
<Class name="org.apache.commons.lang3.time.FastDateParser"/>
- <Method name="getStrategy" />
+ <Or>
+ <Method name="getStrategy" />
+ <Method name="simpleQuote" params="java.lang.StringBuilder, java.lang.String"/>
+ </Or>
<Bug pattern="SF_SWITCH_NO_DEFAULT" />
</Match>