[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipse-dev] Found a few hundred bugs in Eclipse
|
Regarding the following reported error:
M C RV: org.eclipse.search.internal.ui.SearchDialog$1.getText(Object)
ignores return value of java.lang.String.substring(int,int) At
SearchDialog.java:[line 187]
int i= label.indexOf('&');
while (i >= 0) {
if (i < label.length())
label= label.substring(0, i) + label.substring(i+1);
else
label.substring(0, i);
i= label.indexOf('&');
}
The call to substring in the else cause has no effect since the return
value is ignored, so this will be an
infinite loop if the label ends in &.
Not only is the else not need but also the if is not needed. However there
will not be an infinite loop since each iteration cuts away one '&' until
there's none left which results in i being -1 and hence exiting the loop.
Fixed the code.
Dani
Bill Pugh
<pugh@xxxxxxxxxx>
Sent by: To
eclipse-dev-admin eclipse-dev@xxxxxxxxxxx
@eclipse.org cc
Subject
19.07.2004 20:22 [eclipse-dev] Found a few hundred
bugs in Eclipse
Please respond to
eclipse-dev@eclip
se.org
We're working on a open source static analysis tool, called FindBugs,
for finding a number of different kinds
of bugs or antipatterns in Java programs. We've founds lots of bugs in
most large Java programs we've looked
at, including Eclipse. Our tool generates 810 medium/high warnings
about correctness problems in Eclipse 3.0. From
past experience, we believe that corresponds to hundreds of real bugs
(we generally have a less than 50% false
positive rate) [Note: 810 warnings come from all code in all jar files
shipped with Eclipse, which includes some
third-party libraries]
We'd love to get some people in the Eclipse project to start using our
tool. We use Eclipse, have an Eclipse
plugin, and even got an Eclipse innovation award for work on our tool.
However, part of our research is to see if other people think our tool
is finding bugs that they believe
warrant fixing. So we'd really love for people in the Eclipse project
to start using our tool, rather than
having us submit separate bug reports for each bug.
We'd love to work with anyone interested in applying our tool to
Eclipse, and we are always interested in feedback
on improving the accuracy of our existing bug detectors and writing new
ones.
Thanks,
Bill Pugh
FindBugs: http://findbugs.sourceforge.net/
A handful of some of the bugs we found in Eclipse 3.0:
----
H C NP: Null pointer dereference in
org.eclipse.jdt.internal.debug.ui.JDIModelPresentation.getPrimitiveValue
TypeSignature(org.eclipse.jdt.debug.core.IJavaValue)
At JDIModelPresentation.java:[line 535]
String sig= type.getSignature();
if (sig != null || sig.length() == 1) {
return sig;
}
Should be && rather than ||
----
H C NP: Null pointer dereference in
org.eclipse.team.internal.ccvs.core.CVSSyncInfo.getLocalContentIdentifie
r() At CVSSyncInfo.java:[line 357]
IResource local = getLocal();
if (local != null || local.getType() == IResource.FILE) {
Should be && rather than ||
---
M C RV: org.eclipse.search.internal.ui.SearchDialog$1.getText(Object)
ignores return value of java.lang.String.substring(int,int) At
SearchDialog.java:[line 187]
int i= label.indexOf('&');
while (i >= 0) {
if (i < label.length())
label= label.substring(0, i) + label.substring(i+1);
else
label.substring(0, i);
i= label.indexOf('&');
}
The call to substring in the else cause has no effect since the return
value is ignored, so this will be an
infinite loop if the label ends in &.
----
H C Nm: VERY confusing to have methods
org.eclipse.jface.dialogs.InputDialog.getOkButton() and
org.eclipse.jface.dialogs.Dialog.getOKButton()
InputDialog.getOkButton() is apparently intended to override
Dialog.getOKButton(), but doesn't
because the name is capitalized differently.
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
http://dev.eclipse.org/mailman/listinfo/eclipse-dev