[
https://issues.apache.org/jira/browse/WICKET-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546897
]
Johan Karlberg commented on WICKET-830:
---------------------------------------
Actually, x % 2 -has- negative values. If x is negative. so (-5) %2 = -1, which
according to the old test is even. In the uses we hav ein the patch we are
checking an index, which is obviously never negative, but findbugs complains
since it doesn't know that. The patch is to make it keep quiet, and to give
people an alternative that always works, no matter where they get x from.
> FindBugs static alalyser shows many coding issues/errors
> --------------------------------------------------------
>
> Key: WICKET-830
> URL: https://issues.apache.org/jira/browse/WICKET-830
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-beta2
> Reporter: Dariusz Wojtas
> Fix For: 1.3.0-rc2
>
> Attachments: findbugs-badpractice-deadstores.patch.gz,
> findbugs-badpractice-oddness.patch.gz,
> findbugs-badpractice-streamclosing.patch.gz,
> findbugs-badpractice-versionid.patch.gz,
> findbugs-correctness-comparisonwithself.patch.gz,
> findbugs-correctness-impossiblecast.patch.gz,
> findbugs-correctness-possiblenpe-inline.patch.gz,
> findbugs-correctness-possiblenpe.patch.gz,
> findbugs-correctness-redundantnullcheck.patch.gz,
> findbugs-correctness-tostringonarray.patch.gz,
> findbugs-performance-inefficientconstructor.patch.gz,
> findbugs-performance-mapiteration.patch.gz,
> findbugs-performance-redundancy.patch.gz,
> findbugs-performance-stringconcatinloop.patch.gz,
> findbugs-performance-unreadfields.patch.gz
>
>
> After I found WICKET-829 by examining examples, I tried to run FindBugs
> against the wicket - only core jdk-14.
> This showed several easy to fix bugs, nothing really serious.
> I really advice someone to run FindBugs from time to time against the project
> (if installed in Eclipse, it's enough to right click on the project, then 2-5
> minutes of analysis and bugs visible in the Bug Tree View).
> There are tons of issues found, smaller or bigger.
> Some of them are false alarms - like in some tests or inner classes where we
> know something cannot happen.
> But many should be fixed
> Some of the issues found:
> org.apache.wicket.markup.html.form.FormComponent
> has issues in equal (line 653 - different types compared)
> org.apache.wicket.Session.getPage
> line 684 - compares strings with == instead of equals()
> this may be correct but the 'pageMapName' comes as parameter to a public
> method, we never know who will use it
> several classes use dead variables (written, never read). Examples:
> org.apache.wicket.markup.html.form.Button - line 206
> org.apache.wicket.markup.html.image.resource.LocalizedImageResource - lines
> 254, 255
> Some fields should be marked final, but are not. example:
> org.apache.wicket.util.lang.Bytes.MAX
> Impossible cast
> org.apache.wicket.util.io.WicketObjectInputStream.get(string, char) - line
> 535
> Inconsistent synchronization
> Some methods are marked as 'synchronized' when some others are not - when
> working on the same resource.
> Inefficient use of keySet iterator instead of entrySet iterator
> This occurs in several places in loops.
> check always returns true:
> org.apache.wicket.markup.repeater.data.DataViewBase.onDetach - line 144
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.