fixed 4 bugs found by FindBugs plugin in Eclipse

This commit is contained in:
soupwizard 2012-12-26 19:50:06 -08:00
parent 02927d0f2d
commit 69130292f2
4 changed files with 5 additions and 4 deletions

View File

@ -117,7 +117,7 @@ public abstract class ComponentPresetDatabase extends Database<ComponentPreset>
@Override
public List<ComponentPreset> listForTypes( List<ComponentPreset.Type> types ) {
blockUntilLoaded();
return listForTypes( (ComponentPreset.Type[]) types.toArray() );
return listForTypes( types.toArray(new ComponentPreset.Type[types.size()]) );
}
@Override

View File

@ -49,7 +49,7 @@ public class RocketSaver extends RocketComponentSaver {
if (id.equals(defId))
str += " default=\"true\"";
if (rocket.getMotorConfigurationName(id) == "") {
if (rocket.getMotorConfigurationName(id).isEmpty()) {
str += "/>";
} else {
str += "><name>" + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getMotorConfigurationName(id))

View File

@ -6,6 +6,7 @@ import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EventObject;
import java.util.List;
@ -299,7 +300,7 @@ public class BooleanModel extends AbstractAction implements StateChangeListener,
PropertyChangeListener[] listeners = this.getPropertyChangeListeners();
if (listeners.length > 0) {
log.warn("Invalidating " + this + " while still having listeners " + listeners);
log.warn("Invalidating " + this + " while still having listeners " + Arrays.toString(listeners));
for (PropertyChangeListener l : listeners) {
this.removePropertyChangeListener(l);
}

View File

@ -670,7 +670,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
// Check whether data is already up to date
if (flightDataFunctionalID == configuration.getRocket().getFunctionalModID() &&
flightDataMotorID == configuration.getMotorConfigurationID()) {
flightDataMotorID.equals(configuration.getMotorConfigurationID())) {
return;
}