From ede47666f93175985d2e2ae3ca8aaa00532c7868 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Thu, 16 Apr 2020 11:36:47 -0600 Subject: [PATCH] Modified ThrustCurveMotor to ensure all fields have sane default values Created MotorRowFilterTest unit test --- .../sf/openrocket/motor/ThrustCurveMotor.java | 22 +++++++++---------- .../motor/thrustcurve/MotorRowFilter.java | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java index c19c72b02..e8da17ed6 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java @@ -30,21 +30,21 @@ public class ThrustCurveMotor implements Motor, Comparable, Se private static final DesignationComparator DESIGNATION_COMPARATOR = new DesignationComparator(); - private String digest; + private String digest = ""; - private Manufacturer manufacturer; - private String designation; - private String description; - private Motor.Type type; - private double[] delays; + private Manufacturer manufacturer = Manufacturer.getManufacturer("UNKNOWN"); + private String designation = ""; + private String description = ""; + private Motor.Type type = Motor.Type.UNKNOWN; + private double[] delays = {}; private double diameter; private double length; - private double[] time; - private double[] thrust; - private Coordinate[] cg; + private double[] time = {}; + private double[] thrust = {}; + private Coordinate[] cg = {}; - private String caseInfo; - private String propellantInfo; + private String caseInfo = ""; + private String propellantInfo = ""; private double initialMass; private double maxThrust; diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java index 66dd95586..1c96c985b 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java @@ -206,7 +206,7 @@ public class MotorRowFilter extends RowFilter implements Ch if ( m.getLength() > maximumLength ) { return false; } - + if ( m.getLength() < minimumLength ) { return false; }