daveyc123 / findbugs Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/findbugs
Automatically exported from code.google.com/p/findbugs
I would hope that this is not a common design, and so perhaps you don't fix
it, but here's a false positive for BC (instanceof always returns true).
This is a simplified version, but i wasn't sure whether the code i found
was intending on the code to always be initialized. I suppose the test
should just be changed to, == null.. but...
public class BC_FP {
private List l;
public void setList(ArrayList ll) {
l = ll;
}
public void fp() {
if (l instanceof ArrayList) {
System.out.println("FP - what if l is null?");
}
}
}
Original issue reported on code.google.com by [email protected]
on 18 Aug 2009 at 9:21
What steps will reproduce the problem?
1. fdg
2. dfg
3. dfg
What is the expected output? What do you see instead?
dfg
What version of the product are you using? On what operating system?
dfg
Please provide any additional information below.
dfg
Original issue reported on code.google.com by [email protected]
on 18 Jul 2007 at 12:43
See http://netbeans.org/bugzilla/show_bug.cgi?id=199560#c4 for background. I am
not sure who uploaded 1.3.9 to Maven Central, but the POM for the annotations
JAR is incorrect; it fails to refer to the JSR 305 JAR, which is a compile-time
dependency. JDK 6 javac can crash as a result.
By the way - it seems that development is now happening on
code.google.com/p/findbugs, yet findbugs.sourceforge.net makes no direct
mention of this (and still has an open issue tracker with recent additions).
Original issue reported on code.google.com by [email protected]
on 28 Jun 2011 at 4:55
Bug report generated from FindBugs
com.google.protobuf.DescriptorProtos$FileDescriptorProto stored into
non-transient field Descriptors$DescriptorValidationException.proto
In class com.google.protobuf.Descriptors$DescriptorValidationException
Field Descriptors$DescriptorValidationException.proto
Actual type com.google.protobuf.DescriptorProtos$FileDescriptorProto
At Descriptors.java:[line 1565]
Classified as: NOT_A_BUG
Bug pattern explanation:
A non-serializable value is stored into a non-transient field of a
serializable class.
FindBugs issue identifier (do not modify or remove):
8d04c2531746bfa9c642a7fbc92a3297
Original issue reported on code.google.com by keithl
on 27 Jan 2010 at 10:10
Bug report generated from FindBugs
Impossible downcast of toArray() result to
org.eclipse.jdt.internal.corext.refactoring.typeconstraints.ITypeConstraint[]
in create(SingleVariableDeclaration)
In class
org.eclipse.jdt.internal.corext.refactoring.typeconstraints.FullConstraintCreato
r
In method create(SingleVariableDeclaration)
Actual type Object[]
Expected org.eclipse.jdt.internal.corext.refactoring.typeconstraints.ITypeConstraint[]
Return value of java.util.List.toArray()
At FullConstraintCreator.java:[line 393]
Classified as: MOSTLY_HARMLESS
test evaluation
Bug pattern explanation:
This code is casting the result of calling toArray() on a collection to a type
more specific than Object[], as in:
String[] getAsArray(Collection<String> c) {
return (String[]) c.toArray();
}
This will usually fail by throwing a ClassCastException. The toArray() of
almost all collections return an Object[]. They can't really do anything else,
since the Collection object has no reference to the declared generic type of
the collection.
The correct way to do get an array of a specific type from a collection is to
use c.toArray(new String[]); or c.toArray(new String[c.size()]); (the latter
is slightly more efficient).
There is one common/known exception exception to this. The toArray() method of
lists returned by Arrays.asList(...) will return a covariantly typed array.
For example, Arrays.asArray(new String[] { "a" }).toArray() will return a
String
[]. FindBugs attempts to detect and suppress such cases, but may miss some.
FindBugs issue identifier (do not modify or remove):
2c503602f300bdff0bb2465d0b3c7f2a
Original issue reported on code.google.com by keithl
on 11 Feb 2010 at 12:22
After running Findbugs Bug Explorer is empty and the Error message is:
Version:
edu.umd.cs.findbugs.plugin.eclipse_1.3.7.20081230.zip
Message:
An internal error occurred during: "Updating bugs in bug exporer".
Stack trace:
java.lang.NullPointerException
at de.tobject.findbugs.view.explorer.BugContentProvider.addMarker
(BugContentProvider.java:451)
at de.tobject.findbugs.view.explorer.BugContentProvider.updateContent
(BugContentProvider.java:426)
at de.tobject.findbugs.view.explorer.RefreshJob.run(RefreshJob.java:61)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
session:
eclipse.buildId=M20080911-1700
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86
Original issue reported on code.google.com by [email protected]
on 28 Jan 2009 at 3:46
Hi ,
I am generating FindBugs html reports on my source code. I am
using ant to do that. How to stop generating report, if there is nothing to
report
Thanks in Advance
Original issue reported on code.google.com by [email protected]
on 6 Jul 2009 at 3:17
I currently am running findbugs 1.3.9, and am running into a heap space issue.
This I do not believe is any ordinary heap space issue. Like other heap space
issues, you can simply increase the heap space through the Xmx arg, the only
problem is I have -Xmx2500M which is I believe too much. I am also running
findbugs on effort=max. Which I know consumes more memory, but I don't believe
it needs this much memory. The .jar I'm scanning is 15MB if that is significant.
Here is a sample output:
[exec] [findbugs] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
[exec] [findbugs] at java.util.ArrayList.<init>(ArrayList.java:112)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.Frame.<init>(Frame.java:110)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.<init>(ValueNumberFrame.java:58)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:148)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.getFactAfterLocation(ValueNumberAnalysis.java:272)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transferInstruction(ValueNumberAnalysis.java:174)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transferInstruction(ValueNumberAnalysis.java:55)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis.transfer(AbstractDataflowAnalysis.java:117)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:356)
[exec] [findbugs] at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:72)
[exec] [findbugs] at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:47)
[exec] [findbugs] at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:331)
[exec] [findbugs] at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:281)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:937)
[exec] [findbugs] at edu.umd.cs.findbugs.ba.ClassContext.getValueNumberDataflow(ClassContext.java:356)
[exec] [findbugs] at edu.umd.cs.findbugs.detect.FindSelfComparison2.analyzeMethod(FindSelfComparison2.java:89)
[exec] [findbugs] at edu.umd.cs.findbugs.detect.FindSelfComparison2.visitClassContext(FindSelfComparison2.java:72)
[exec] [findbugs] at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68)
[exec] [findbugs] at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:971)
[exec] [findbugs] at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:222)
[exec] [findbugs] at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:323)
[exec] [findbugs] at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1049)
[exec] [findbugs] Java Result: 1
Original issue reported on code.google.com by [email protected]
on 14 Mar 2011 at 8:50
What steps will reproduce the problem?
Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net). I don't remember everything
I did to get into this situation.
What is the expected output? What do you see instead?
I got this exception when trying to save the project:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at
edu.umd.cs.findbugs.SortedBugCollection.writePrologue(SortedBugCollection.java:2
79)
at
edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.java:328)
at
edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.java:265)
at edu.umd.cs.findbugs.gui2.BugSaver.saveBugs(BugSaver.java:53)
at edu.umd.cs.findbugs.gui2.BugSaver.saveBugs(BugSaver.java:63)
at edu.umd.cs.findbugs.gui2.MainFrame.save(MainFrame.java:1930)
at edu.umd.cs.findbugs.gui2.MainFrame.access$1300(MainFrame.java:127)
at
edu.umd.cs.findbugs.gui2.MainFrame$12.actionPerformed(MainFrame.java:611)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.jav
a:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:2
42)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163
)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at
edu.umd.cs.findbugs.SortedBugCollection.writePrologue(SortedBugCollection.java:2
79)
at
edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.java:328)
at
edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.java:265)
at edu.umd.cs.findbugs.gui2.BugSaver.saveBugs(BugSaver.java:53)
at edu.umd.cs.findbugs.gui2.BugSaver.saveBugs(BugSaver.java:63)
at edu.umd.cs.findbugs.gui2.MainFrame.save(MainFrame.java:1930)
at edu.umd.cs.findbugs.gui2.MainFrame.access$1300(MainFrame.java:127)
at
edu.umd.cs.findbugs.gui2.MainFrame$12.actionPerformed(MainFrame.java:611)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.jav
a:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:2
42)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163
)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
What version of the product are you using? On what operating system?
FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2006 at 8:27
Bug report generated from FindBugs
Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in
compareRange(int, int, Name)
In class com.sun.jndi.dns.DnsName
In method compareRange(int, int, Name)
Actual type javax.naming.CompositeName
Expected com.sun.jndi.dns.DnsName
Value loaded from n
At DnsName.java:[line 390]
Relevant source code:
386: * greater than those of "n".
387: */
388: private int compareRange(int beg, int end, Name n) {
389: if (n instanceof CompositeName) {
390: n = (DnsName) n; // force ClassCastException
391: }
392: // Loop through labels, starting with most significant.
393: int minSize = Math.min(end - beg, n.size());
394: for (int i = 0; i < minSize; i++) {
Bug pattern explanation:
This cast will always throw a ClassCastException. FindBugs tracks type
information from instanceof checks, and also uses more precise information
about the types of values returned from methods and loaded from fields. Thus,
it may have more precise information that just the declared type of a
variable, and can use this to determine that a cast will always throw an
exception at runtime.
FindBugs issue identifier (do not modify or remove):
b9c5e422ce21dc230c2d8195629f9ab1
Original issue reported on code.google.com by keithl
on 24 Feb 2010 at 3:16
Bug report generated from FindBugs
instanceof will always return false in loadFromStream(LEDataInputStream), since
a RuntimeException can't be a java.io.IOException
In class org.eclipse.swt.internal.image.FileFormat
In method loadFromStream(LEDataInputStream)
Actual type RuntimeException
Expected java.io.IOException
Value loaded from e
At FileFormat.java:[line 50]
Relevant source code:
46: try {
47: inputStream = stream;
48: return loadFromByteStream();
49: } catch (Exception e) {
50: if (e instanceof IOException) {
51: SWT.error(SWT.ERROR_IO, e);
52: } else {
53: SWT.error(SWT.ERROR_INVALID_IMAGE, e);
54: }
Bug pattern explanation:
This instanceof test will always return false. Although this is safe, make
sure it isn't an indication of some misunderstanding or some other logic error.
FindBugs issue identifier (do not modify or remove):
472230fd849b9300f02de246aa190df3
Original issue reported on code.google.com by keithl
on 17 Feb 2010 at 3:02
Please use SourceForge trackers for bug reports and feature enhancements:
https://sourceforge.net/tracker2/?group_id=96405
Thank you for the feedback!
Regards,
Andrei
Original issue reported on code.google.com by iloveeclipse
on 31 Jan 2009 at 10:19
Hi ,
I am generating FindBugs html reports on my source code. I am
using ant to do that. How to stop generating report, if there is nothing to
report
Thanks in Advance
Original issue reported on code.google.com by [email protected]
on 6 Jul 2009 at 3:17
Bug report generated from FindBugs
instanceof will always return false in shareStrings(StringPool), since a
org.eclipse.core.internal.resources.IMarkerSetElement can't be a String
In class org.eclipse.core.internal.resources.MarkerSet
In method shareStrings(StringPool)
Actual type org.eclipse.core.internal.resources.IMarkerSetElement
Expected String
Value loaded from o
At MarkerSet.java:[line 238]
Bug pattern explanation:
This instanceof test will always return false. Although this is safe, make
sure it isn't an indication of some misunderstanding or some other logic error.
FindBugs issue identifier (do not modify or remove):
d75a10dfc7c2ebdaa1e6f59eb9bc05c9
Original issue reported on code.google.com by keithl
on 11 Feb 2010 at 12:32
Where can this project be found?
Original issue reported on code.google.com by [email protected]
on 10 Oct 2007 at 7:35
What steps will reproduce the problem?
Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net).
There are several instances of code such as the following:
if (message instanceof SMTPMessage)
from = ((SMTPMessage)message).getEnvelopeFrom();
What is the expected output? What do you see instead?
Complains about an unchecked cast.
What version of the product are you using? On what operating system?
FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2006 at 8:11
Bug report generated from FindBugs
Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in
addAll(int, Name)
In class com.sun.jndi.dns.DnsName
In method addAll(int, Name)
Actual type javax.naming.CompositeName
Expected com.sun.jndi.dns.DnsName
Value loaded from n
At DnsName.java:[line 363]
Relevant source code:
359: domain = null;
360: }
361:
362: } else if (n instanceof CompositeName) {
363: n = (DnsName) n; // force ClassCastException
Classified as: MOSTLY_HARMLESS
Bug pattern explanation:
This cast will always throw a ClassCastException. FindBugs tracks type
information from instanceof checks, and also uses more precise information
about the types of values returned from methods and loaded from fields. Thus,
it may have more precise information that just the declared type of a
variable, and can use this to determine that a cast will always throw an
exception at runtime.
FindBugs issue identifier (do not modify or remove):
9f539f18993066f5fa629c57f23a982c
Original issue reported on code.google.com by keithl
on 24 Feb 2010 at 3:09
What steps will reproduce the problem?
Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net). Select an error that
cauases source code to be displayed.
What is the expected output? What do you see instead?
Formatting of source code containing tabs is incorrect.
Tabs should be handled properly or expanded to 8-space
tab stops before display. Prepending line numbers to each
line should not effect effect formatting but should push
all text to the right.
What version of the product are you using? On what operating system?
FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2006 at 8:34
In javadocs for java.io.PrintStream
(http://java.sun.com/j2se/1.4.2/docs/api/java/io/PrintStream.html)
"Unlike other output streams, a PrintStream never throws an IOException;
instead, exceptional situations merely set an internal flag that can be tested
via the checkError method. "
similar for java.io.PrintWriter.
Perhaps findbugs should warn when calling write and not checking the error
status.
Original issue reported on code.google.com by [email protected]
on 2 Oct 2009 at 11:07
What steps will reproduce the problem?
1. in .fbprefs, set excludefilter0 to filepath, eg
=c:/myproject/findbugs-exclude.xml
2. refresh eclipse project
What is the expected output? What do you see instead?
Expected output is
1) to have the filter taken into account and
2) to see in the project properties -> findbugs page
c:/myproject/findbugs-exclude.xml
Actual output is
1) filter not taken into account, I assume it searches only in the
classpath, not filesystem
2) project properties -> findbugs page shows /myproject/findbugs-exclude.xml
(it does work when filter file placed in same dir as project (so in
multi-module system you need to copy them all over to make the plugin work)
What version of the product are you using? On what operating system?
v1.3.8.20090111
OS=WinXP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 16 Jan 2009 at 10:25
Bug report generated from FindBugs
Bad attempt to compute absolute value of signed 32-bit hashcode in
keyHash(Object)
In class org.eclipse.core.internal.registry.KeyedHashSet
In method keyHash(Object)
At KeyedHashSet.java:[line 199]
Relevant source code:
195: return elementCount == 0;
196: }
197:
198: private int keyHash(Object key) {
199: return Math.abs(key.hashCode()) % elements.length;
200: }
Bug pattern explanation:
This code generates a hashcode and then computes the absolute value of that
hashcode. If the hashcode is Integer.MIN_VALUE, then the result will be
negative as well (since Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE).
One out of 2^32 strings have a hashCode of Integer.MIN_VALUE, including
"polygenelubricants" "GydZG_" and ""DESIGNING WORKHOUSES".
FindBugs issue identifier (do not modify or remove):
888eafd4c7b9cebad1d3f06bee07455f
Original issue reported on code.google.com by keithl
on 17 Feb 2010 at 3:33
Reproduction steps:
1. check out rev. 13120 and version 1.3.9 of findbugs
2. on each, perform: cd findbugsTestCases; ant
select output from 1.3.9:
[findbugs] Warnings generated: 1977
[findbugs] Missing classes: 11
[findbugs] Calculating exit code...
[findbugs] Setting 'missing class' flag (2)
[findbugs] Setting 'bugs found' flag (1)
[findbugs] Exit code set to: 3
[findbugs] Java Result: 3
[findbugs] Classes needed for analysis were missing
[findbugs] Output saved to build/normal.xml
select output from rev. 13120:
[findbugs] Executing findbugs from ant task
[findbugs] Running FindBugs...
[findbugs] Calculating exit code...
[findbugs] Exit code set to: 0
[findbugs] Output saved to build/normal.xml
[findbugs] Executing findbugs from ant task
[findbugs] Running FindBugs...
[findbugs] Calculating exit code...
[findbugs] Exit code set to: 0
[findbugs] Output saved to build/normal.html
I ran this w/ ant v. 1.8.1; java 1.6_22 on linux kernel version 2.6.36, 64bit
userspace.
I encounter this non-reporting problem when using a rev. 13120 findbugs-ant.jar
on my own projects. I expect that specifying "<findbugs ... reportLevel="low"
..." will cause findbugs to report all bugs found. Nonetheless, when
TextUiCommandLine lns. 584-5 are executed, they set a rankThreshold and
priorityThreshold that cause two of my test case
bugs--ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD and
URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD--to fail the test at ln. 175 of
AbstractBugReporter and thus they are not reported.
Further, I can see that only a small subset of available detectors are ever
applied to my classes (the ones in detectorList, which is populated in ln. 1039
of FindBugs2). I expected that all detectors in edu.umd.cs.findbugs.detect
would be applied if I didn't specify an inclusion or exclusion list. It looks
like a lot more detectors (some 155) are added to a plugin's
detectorFactoryList , but I'm not clear on the intended use of that list and
the later-populated detectorList.
Original issue reported on code.google.com by [email protected]
on 7 Feb 2011 at 10:57
What steps will reproduce the problem?
Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net).
What is the expected output? What do you see instead?
I get the following errors on the console:
Error checking for dead exception store
Error checking for dead exception store
Error checking for dead exception store
Error checking for dead exception store
Detector edu.umd.cs.findbugs.detect.FindBadCast2 caught exception while
analyzing javax.mail.internet.MimeUtility.<clinit> : ()V
What version of the product are you using? On what operating system?
FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2006 at 8:05
Bug report generated from FindBugs
Impossible downcast of toArray() result to
org.eclipse.jdt.internal.corext.refactoring.typeconstraints.ITypeConstraint[]
in create(SingleVariableDeclaration)
In class
org.eclipse.jdt.internal.corext.refactoring.typeconstraints.FullConstraintCreato
r
In method create(SingleVariableDeclaration)
Actual type Object[]
Expected org.eclipse.jdt.internal.corext.refactoring.typeconstraints.ITypeConstraint[]
Return value of java.util.List.toArray()
At FullConstraintCreator.java:[line 393]
Classified as: MOSTLY_HARMLESS
test evaluation
Bug pattern explanation:
This code is casting the result of calling toArray() on a collection to a type
more specific than Object[], as in:
String[] getAsArray(Collection<String> c) {
return (String[]) c.toArray();
}
This will usually fail by throwing a ClassCastException. The toArray() of
almost all collections return an Object[]. They can't really do anything else,
since the Collection object has no reference to the declared generic type of
the collection.
The correct way to do get an array of a specific type from a collection is to
use c.toArray(new String[]); or c.toArray(new String[c.size()]); (the latter
is slightly more efficient).
There is one common/known exception exception to this. The toArray() method of
lists returned by Arrays.asList(...) will return a covariantly typed array.
For example, Arrays.asArray(new String[] { "a" }).toArray() will return a
String
[]. FindBugs attempts to detect and suppress such cases, but may miss some.
FindBugs issue identifier (do not modify or remove):
2c503602f300bdff0bb2465d0b3c7f2a
Original issue reported on code.google.com by keithl
on 11 Feb 2010 at 12:17
What steps will reproduce the problem?
1. Checkout the code svn checkout http://findbugs.googlecode.com/svn/trunk/
findbugs-read-only
2. Look in findbugs/lib
3. There is a bcel.jar file without a version number in the file name.
4. Look in the bcel.jar file
$ jar xf bcel.jar META-INF
$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_16-133 (Apple Inc.)
Expected: The version of the BCEL library being used.
Actual: No version number in either the file name or the Manifest.
I need the version so I may follow the code that makes use of BCEL classes
when writing my own detector, to see for example what methods are available
in InvokeInstruction when stepping through the code.
There is a workaround, which is to just replace bcel.jar with the latest
stable release of bcel from the apache website. But it's not ideal. Better
make the project plug and play by ensuring the dependencies to third party
libraries are clearly versioned.
Original issue reported on code.google.com by [email protected]
on 20 Feb 2010 at 1:29
What steps will reproduce the problem?
Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net). Open existing project,
select "redo analysis".
What is the expected output? What do you see instead?
Project name switches to "<<unnamed project>>" and project
can't be saved.
What version of the product are you using? On what operating system?
FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2006 at 8:30
This is a cumulative patch/bug report for 3 issues.
1) AS IS: Bugs which are in inner *member* classes (*named* classes which
are declared inside of method body of another class) leads to
NumberFormatExceptions in FindBugs plugins, so that they are not reported
and not visible in Eclipse at all.
Exemple from Eclipse log:
java.lang.NumberFormatException: For input string: "1MyRunnable"
at java.lang.NumberFormatException.forInputString(NumberFormatException.jav
a:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
at de.tobject.findbugs.reporter.MarkerUtil.findChildSourceLine(MarkerUtil.j
ava:249)
at de.tobject.findbugs.reporter.MarkerUtil.completeInnerClassInfo(MarkerUti
l.java:195)
at de.tobject.findbugs.reporter.MarkerUtil.getUnderlyingResource(MarkerUtil
.java:176)
at de.tobject.findbugs.reporter.MarkerUtil.createMarker(MarkerUtil.java:93)
at de.tobject.findbugs.reporter.Reporter.doReportBug(Reporter.java:111)
TO BE: no exception, bug is propely reported
2) AS IS: Bug markers which are in inner classes are not always shown in
editor, because FindBugs plugin may use -1 as a source location (if the
line was not reported in the bug), so that Eclipse shows the bug in the
Problems view but not in the editor (editor lines starts with 1).
TO BE: bug is propely reported in editor too
3) AS IS: Bug markers for fields which shown in the Problems view are
never at the right location in the editor, because this info is not
available in the bug instance.
TO BE: bug is propely reported in editor too
Seen with the latest FindBugs from SVN with Eclipse 3.2.2 and JDK 1.5
Please use the patch attached below to fix all three problems.
Original issue reported on code.google.com by [email protected]
on 30 Oct 2006 at 10:24
Attachments:
Bug report generated from FindBugs
32 bit int shifted by 56 bits in read8(RandomAccessFile)
In class org.eclipse.equinox.internal.p2.swt.tools.IconExe
In method read8(RandomAccessFile)
Shifted by 56 bits
Local variable named b7
At IconExe.java:[line 703]
Relevant source code:
699: int b4 = raf.readByte() & 0xFF;
700: int b5 = raf.readByte() & 0xFF;
701: int b6 = raf.readByte() & 0xFF;
702: int b7 = raf.readByte() & 0xFF;
703: return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0;
704: }
705: static void write4(RandomAccessFile raf, int value) throws IOException {
706: raf.write(value & 0xFF);
707: raf.write((value >> 8) & 0xFF);
Bug pattern explanation:
The code performs shift of a 32 bit int by a constant amount outside the range
0..31. The effect of this is to use the lower 5 bits of the integer value to
decide how much to shift by (e.g., shifting by 40 bits is the same as shifting
by 8 bits, and shifting by 32 bits is the same as shifting by zero bits). This
probably isn't want was expected, and it at least confusing.
FindBugs issue identifier (do not modify or remove):
cd7ea7a84ba76dc27b4db4189e1443d6
Original issue reported on code.google.com by keithl
on 17 Feb 2010 at 3:01
At the moment MarkerReporter.java is using severity = WARNING so all
FindBugs issues will be displayed as warning messages in Problems view. It
would be great if I can configure FindBugs plugin to display issues as
error messages (i.e. IMarker.SEVERITY_ERROR)
Original issue reported on code.google.com by [email protected]
on 7 Jul 2009 at 4:22
Hi,
This is the Japanese message file. Please inporporate it into 1.1.2.
Thanks,
Original issue reported on code.google.com by [email protected]
on 6 Dec 2006 at 1:31
Attachments:
Hi,
I've already sent an email with this patch to Bill Pugh, but probably my
mail was filtered as spam (I haven't received any answer), so I've decided
to post this patch here.
Patch to UserPreferences class:
we hold all project preferences in VCS, so that we could esily track any
changes. Unfortunately the current FindBugs .fbprefs file is baked by
Property class. This means that each time you add/remove a key, the key
order may be randomly changed for *all* other keys too. Another problem is
the *format* of the key elements for detector enablement. Current format
is "detector<Number>", where <Number> is just a position of detector in
the iterator, created by iterator over property file, which returns
*random* numbers for the same detector each time you store the values.
Old example:
#FindBugs User Preferences
#Mon Dec 04 23:52:02 CET 2006
detector0=SluggishGui|true
detector100=AbnormalFinallyBlockReturn|true
detector101=IncompatMask|true
AS IS: removing "SluggishGui" detector would change the key names for
AbnormalFinallyBlockReturn and IncompatMask, so that all three lines in
the porperty file would be marked as changed by diff tool.
TO BE: it would be nice to have a preferences where changes of *one*
detector setting would lead only to *one* line change compared to previous
state.
My patch changes the key creation shema and allows the Property file be
always stored in a sorted state to the disk. Both changes together
guaranteed you the requirement above.
My patch is compatible to already existing .fbprefs files.
Regards,
Andrei Loskutov
Original issue reported on code.google.com by [email protected]
on 8 Dec 2006 at 10:21
Attachments:
Bug report generated from FindBugs
Method call in run() passes null for nonnull parameter of
MainFrame.access$3700(MainFrame, Project, BugCollection)
In class edu.umd.cs.findbugs.gui2.MainFrame$46
In method run()
Called method MainFrame.access$3700(MainFrame, Project, BugCollection)
Argument 2 might be null but must not be null
Value loaded from project
Method invoked at MainFrame.java:[line 3019]
Known null at MainFrame.java:[line 3017]
This issue found by FindBugs
Relevant source code:
3013: Runnable runnable = new Runnable(){
3014: public void run()
3015: {
3016: final Project project = BugLoader.loadProject(MainFrame.this, f);
3017: final BugCollection bc = project == null ? null : BugLoader.doAnalysis(project);
3018: updateProjectAndBugCollection(project, bc, null);
3019: setProjectAndBugCollectionInSwingThread(project, bc);
3020: }
3021: };
3022: if (EventQueue.isDispatchThread())
3023: new Thread(runnable).start();
Bug pattern explanation:
This method call passes a null value for a nonnull method parameter. Either
the parameter is annotated as a parameter that should always be nonnull, or
analysis has shown that it will always be dereferenced.
FindBugs issue identifier (do not modify or remove):
7573075c2a196813967a3e4cab84bb83
Original issue reported on code.google.com by [email protected]
on 19 Feb 2010 at 6:41
[deleted issue]
If I try to run multiple bugreporters inherited from TextUIBugReporter only
the last reporter set in the FindBugs2 setBugReporter method run its finish
method.
All run the doReportBug(BugInstance bugInstance) method.
The finish
What version of the product are you using? On what operating system?
1.2.0 or 1.2.1
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 26 Sep 2007 at 6:10
Fix JavaDoc for getPrimaryField method
Original issue reported on code.google.com by [email protected]
on 22 Apr 2012 at 3:05
Attachments:
run findbugs on the followed class:
public class Test {
private void testNamedInnerClass() {
class B implements Runnable {
public void run() {
String s = null;
s.equals(new Object() {
void test(){
String s = null;
s.equals(new Object() {
});
}
});
}
}
}
private void testAnonymousClass() {
Thread t = new Thread(new Runnable (){
public void run() {
String s = null;
s.equals(new Object() {
void test(){
String s = null;
s.equals(new Object() {
});
}
});
}
});
}
}
AS IS:
NP bug ("Null pointer dereference") is reported only twice
TO BE:
there are 4 NP bugs.
The bugs inside of inner member classes (both named or anonymous) are not
reported at all. It looks like FindBugs either ignores these classes
during bug search or could not report bugs for.
Using latest FindBugs from SVN on Eclipse 3.2.2 with JDK 1.5
Original issue reported on code.google.com by [email protected]
on 30 Oct 2006 at 10:35
Bug report generated from FindBugs
instanceof will always return false in getParent(Object), since a
org.eclipse.pde.internal.runtime.registry.model.ModelObject can't be a
org.eclipse.pde.internal.runtime.registry.model.Folder
In class
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider
In method getParent(Object)
Actual type org.eclipse.pde.internal.runtime.registry.model.ModelObject
Expected org.eclipse.pde.internal.runtime.registry.model.Folder
Value loaded from element
At RegistryBrowserContentProvider.java:[line 150]
Relevant source code:
146: if (!(element instanceof ModelObject)) {
147: return null;
148: }
149:
150: if (element instanceof Folder) {
151: return ((Folder) element).getParent();
152: }
Bug pattern explanation:
This instanceof test will always return false. Although this is safe, make
sure it isn't an indication of some misunderstanding or some other logic error.
FindBugs issue identifier (do not modify or remove):
9e4d5c508219591c50874d236336d24f
Original issue reported on code.google.com by keithl
on 17 Feb 2010 at 2:44
AS IS:
In projects, which contains more then one class folder with generated
classes (say one is the default one from Eclipse, another one is temporary
created by ant during deployment task) FindBugs report bugs in both
folders, even if some of folders are not on the class path of the project.
This lead to duplicated time used to search bugs in Eclipse and to wrong
bug markers generated (or to not generated at all).
TO BE:
FindBugs should search for bugs only in class folders which are on the
classpath of Java project.
Using latest FindBugs build from SVN head with Eclipse 3.2.2 on JDK 1.5.
Patch (against head) which solves the problem is attached below.
Original issue reported on code.google.com by [email protected]
on 30 Oct 2006 at 10:11
Attachments:
Bug report generated from FindBugs
32 bit int shifted by 48 bits in read8(RandomAccessFile)
In class org.eclipse.equinox.internal.p2.swt.tools.IconExe
In method read8(RandomAccessFile)
Shifted by 48 bits
Local variable named b6
At IconExe.java:[line 703]
Relevant source code:
699: int b4 = raf.readByte() & 0xFF;
700: int b5 = raf.readByte() & 0xFF;
701: int b6 = raf.readByte() & 0xFF;
702: int b7 = raf.readByte() & 0xFF;
703: return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0;
704: }
705: static void write4(RandomAccessFile raf, int value) throws IOException {
706: raf.write(value & 0xFF);
707: raf.write((value >> 8) & 0xFF);
Bug pattern explanation:
The code performs shift of a 32 bit int by a constant amount outside the range
0..31. The effect of this is to use the lower 5 bits of the integer value to
decide how much to shift by (e.g., shifting by 40 bits is the same as shifting
by 8 bits, and shifting by 32 bits is the same as shifting by zero bits). This
probably isn't want was expected, and it at least confusing.
FindBugs issue identifier (do not modify or remove):
6cc92720328a529bbd7d368584984203
Original issue reported on code.google.com by keithl
on 17 Feb 2010 at 3:01
original report 26 July 2006 by Ruimo Uno (Shisei Hanai)
--------
Hi,
The DumbMethods detector in FIndBugs-1.0.0 reports the
DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION against the following
code:
Method m = String.class.getMethod("getBytes", new Class[] {int.class,
int.class, byte[].class, int.class});
if (m.isAnnotationPresent(Deprecated.class)) {
Since the retention policy of the @Deprecated is the RUNTIME, this is a false
positive. It seems that the DumbMethods uses a retention class database that
is set by the visitAnnotation(). As a result, FindBugs can report correctly
only
for visited annotation classes and other classes are wrongly reported as bugs.
Is this as designed?
Original issue reported on code.google.com by [email protected]
on 28 Jul 2006 at 1:59
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.