#20 first potential bug I found while running findBugs

Bug
open
nobody
Other (11)
5
2011-12-14
2011-12-14
Anonymous
No

OpenRocket Version: 1.1.9
I used a program called findBugs to look for potential bugs in the openRocket program. FindBugs looks for bugs in Java programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Bug patterns arise for a variety of reasons:

Difficult language features
Misunderstood API methods
Misunderstood invariants when code is modified during maintenance
Garden variety mistakes: typos, use of the wrong boolean operator

the first bug I found was a Comparison of String object using the == operator in net.sf.openrocket.gui.scalefigure.RocketPanel.upadateExtras():

flightDataMotorID == configuration.getMotorConfigurationID()
This code compares java.Lang.String objects for reference equality using the == operators. Unless both strings are either constants in a source file, or have been interned using the String.intern() method, the same string value may be represented by two different String objects.
Corrected by using the equals(Object) method instead

Discussion

  •  
    Attachments