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
Bug: net.sf.openrocket.areodynamics.Warning.equals(Object) does not check for null argument
public boolean equals(Object o) {
return (o.getClass() == this.getClass());
}
This implementation of equals(Object) violates the contract defined by java.lang.Object.equals()
because it does not check for null being passed as the argument.
All equals() methods should return false if passed a null value.
Corrected by doing this instead:
public boolean equals(Object o) {
if(o.equals(null))
return false;
return (o.getClass() == this.getClass());
}