Merge pull request #1205 from JoePfeiffer/fix-1174

Make motor database search more robust, especially when loading files
This commit is contained in:
SiboVG 2022-03-01 19:50:17 +01:00 committed by GitHub
commit 930881dae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -45,8 +45,8 @@ public class ThrustCurveMotorSetDatabase implements MotorDatabase {
else if (manufacturer != null && !m.getManufacturer().matches(manufacturer))
matchDescription = false;
else if (designation != null &&
!designation.equalsIgnoreCase(m.getDesignation()) &&
!designation.equalsIgnoreCase(m.getCommonName()))
!m.getDesignation().toUpperCase().contains(designation.toUpperCase()) &&
!designation.toUpperCase().contains(m.getCommonName().toUpperCase()))
matchDescription = false;
else if (!Double.isNaN(diameter) && (Math.abs(diameter - m.getDiameter()) > 0.005))
matchDescription = false;

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.file.openrocket.importt;
import java.lang.Double;
import java.util.HashMap;
import java.util.Locale;
@ -42,7 +44,7 @@ class MotorHandler extends AbstractElementHandler {
* Return the motor to use, or null.
*/
public Motor getMotor(WarningSet warnings) {
return context.getMotorFinder().findMotor(type, manufacturer, designation, diameter, length, digest, warnings);
return context.getMotorFinder().findMotor(type, manufacturer, designation, Double.NaN, Double.NaN, digest, warnings);
}
/**