[ 
https://issues.apache.org/jira/browse/WICKET-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546881
 ] 

Igor Vaynberg commented on WICKET-830:
--------------------------------------

wtf, 

Index: 
jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/SortingPage.java
===================================================================
--- 
jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/SortingPage.java
  (revision 599365)
+++ 
jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/SortingPage.java
  Thu Nov 29 20:45:22 CET 2007
@@ -55,7 +55,7 @@
                                {
                                        public Object getObject()
                                        {
-                                               return (item.getIndex() % 2 == 
1) ? "even" : "odd";
+                                               return (item.getIndex() % 2 != 
0) ? "even" : "odd";
                                        }
                                }));
                        }


> 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.

Reply via email to