pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject FindBugs Analysis
Date Fri, 17 Jun 2011 14:12:40 GMT
Hi all,
after a quick Check with FindBugs of the trunk, there are some small things,
this is the list (but they are all under the "Normal" priority :-) ), tell
me if you prefer in issue to keep track on this for release notes of 2.0.1 .

Most of them are trivial to fix (and/or small things that could even stay as
is), and otherwise objections I'll start to fix as soon as possible.


Disclaimer: 
we have already discuss time ago on some of them, so they are here just for
completeness :-) ...


Some low-impact things:
charts/src/org/apache/pivot/charts/content/ValueSeries.java:1
org.apache.pivot.charts.content.ValueSeries doesn't override
org.apache.pivot.collections.ArrayList.equals(Object)
tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java:45 Write
to static field org.apache.pivot.tutorials.webqueries.Expenses.instance from
instance method new org.apache.pivot.tutorials.webqueries.Expenses()

demos/src/org/apache/pivot/demos/roweditor/AmountBindMapping.java:36
org.apache.pivot.demos.roweditor.AmountBindMapping.valueOf(String) invokes
inefficient new String(String) constructor
demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java:82 Method
org.apache.pivot.demos.rss.RSSItemRenderer.render(Object, int, ListView,
boolean, boolean, boolean, boolean) concatenates strings using + in a loop


Some not-so-important but trivial (I can fix them as soon as possible, just
to reduce noise):
tests/src/org/apache/pivot/tests/ShutdownTest.java:55 Unchecked/unconfirmed
cast from org.apache.pivot.wtk.Dialog to org.apache.pivot.wtk.Alert
tests/src/org/apache/pivot/tests/issues/Pivot714.java:67 Exception is caught
when Exception is not thrown
tests/src/org/apache/pivot/tests/ResultListTest.java:40
org.apache.pivot.tests.ResultListTest.main(String[]) may fail to close
Statement
core/test/org/apache/pivot/serialization/test/StringSerializerTest.java:54
org.apache.pivot.serialization.test.StringSerializerTest.readValues()
invokes inefficient new String(String) constructor
core/test/org/apache/pivot/serialization/test/StringSerializerTest.java:78
org.apache.pivot.serialization.test.StringSerializerTest.writeValues()
invokes inefficient new String(String) constructor

core/src/org/apache/pivot/beans/BXMLSerializer.java:1009 Load of known null
value
because there propertyClass is always null ... is it right (in that case
probably FindBugs prefer a null instead so it's not in doubt) ... but we can
put this as a false positive

This is small but interesting:
demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java:134
org.apache.pivot.demos.rest.server.RESTDemoServlet.doDelete(QueryServlet$Path)
ignores exceptional return value of java.io.File.delete()
the method (from the interface) is void doDelete, so it couldn't return for
example a boolean value like the boolean doPut ...
Some info:
http://stackoverflow.com/questions/1051004/how-to-send-put-delete-http-request-in-httpurlconnection-looks-like-not-workin
and
http://www.ietf.org/rfc/rfc2616.txt
...
9.7 DELETE
...
so, to not change the method signature (and in any case not before the 2.1
release)
couldn't it be useful to have real implementations od the doDelete to return
(in some way) to the caller the result of the delete operation ?
And later see if something in the QueryServlet has to be changed, ok ?


Others:
core/test/org/apache/pivot/json/test/BindTest.java:111 instanceof will
always return true, since all org.apache.pivot.json.test.SampleBean2 are
instances of org.apache.pivot.json.test.SampleBean2
core/src/org/apache/pivot/beans/BXMLSerializer.java:319 Method
org.apache.pivot.beans.BXMLSerializer$1.putAll(Map) makes inefficient use of
keySet iterator instead of entrySet iterator
core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java:127
org.apache.pivot.text.CharSequenceCharacterIterator.clone() does not call
super.clone()

wtk/src/org/apache/pivot/wtk/TextPane.java:114 Should
org.apache.pivot.wtk.TextPane$RangeRemovedEdit be a _static_ inner class?
wtk/src/org/apache/pivot/wtk/TextPane.java:134 Should
org.apache.pivot.wtk.TextPane$RangeInsertedEdit be a _static_ inner class?
wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java:145
org.apache.pivot.wtk.DesktopApplicationContext$DesktopDisplayHost$3 stored
into non-transient field
DesktopApplicationContext$DesktopDisplayHost.updateHostWindowTitleBarCallback
wtk/src/org/apache/pivot/wtk/TreeView.java:438
org.apache.pivot.wtk.TreeView$BranchHandler doesn't override
org.apache.pivot.collections.ArrayList.equals(Object)
wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java:73
org.apache.pivot.wtk.DesktopApplicationContext$DesktopDisplayHost$1 stored
into non-transient field
DesktopApplicationContext$DesktopDisplayHost.rootOwnerListener
wtk/src/org/apache/pivot/wtk/TreeView.java:415
org.apache.pivot.wtk.TreeView$PathComparator implements Comparator but not
Serializable
wtk/src/org/apache/pivot/wtk/content/TableViewDateCellRenderer.java:34 Found
static field of type java.text.DateFormat
wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java:522 Exception is
caught when Exception is not thrown

wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java:88
Dead store to increment
And last:
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java:108
Unchecked/unconfirmed cast from org.apache.pivot.wtk.Window to
org.apache.pivot.wtk.Alert
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java:307
Unchecked/unconfirmed cast from org.apache.pivot.wtk.Window to
org.apache.pivot.wtk.SuggestionPopup
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java:273
Unchecked/unconfirmed cast from org.apache.pivot.wtk.Sheet to
org.apache.pivot.wtk.FileBrowserSheet
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java:107
Unchecked/unconfirmed cast from org.apache.pivot.wtk.Window to
org.apache.pivot.wtk.Prompt
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java:225
Unchecked/unconfirmed cast from org.apache.pivot.wtk.Window to
org.apache.pivot.wtk.MenuPopup
but probably for these could be better to change the signature of generics
here, like <... extends ...> or something like this, to have compile-time
checks ... maybe in the 2.1 release, right ?

And for today that's all.

Bye,
Sandro



--
View this message in context: http://apache-pivot-developers.417237.n3.nabble.com/FindBugs-Analysis-tp3076403p3076403.html
Sent from the Apache Pivot - Developers mailing list archive at Nabble.com.

Mime
View raw message