Change toLowerCase() to toLowerCase(Locale.ENGLISH)
This commit is contained in:
parent
3fa0f9ce67
commit
9c6b275e84
@ -1,3 +1,7 @@
|
||||
2012-03-25 Sampo Niskanen
|
||||
|
||||
* [BUG] Removed locale-specific toLowerCase/toUpperCase
|
||||
|
||||
2012-03-25 Doug Pedrick
|
||||
|
||||
* Printed rocket figure in design report now honors rotation angle of main figure; fixed bug in layout where the
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.arch;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.util.BugException;
|
||||
|
||||
@ -26,7 +27,7 @@ public class SystemInfo {
|
||||
* @return the operating system of the current system.
|
||||
*/
|
||||
public static Platform getPlatform() {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (os.indexOf("win") >= 0) {
|
||||
return Platform.WINDOWS;
|
||||
|
@ -183,7 +183,7 @@ public class UpdateInfoRetriever {
|
||||
|
||||
String contentType = connection.getContentType();
|
||||
if (contentType == null ||
|
||||
contentType.toLowerCase().indexOf(Communicator.UPDATE_INFO_CONTENT_TYPE) < 0) {
|
||||
contentType.toLowerCase(Locale.ENGLISH).indexOf(Communicator.UPDATE_INFO_CONTENT_TYPE) < 0) {
|
||||
// Unknown response type
|
||||
log.warn("Unknown Content-type received:" + contentType);
|
||||
return;
|
||||
|
@ -8,6 +8,7 @@ import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.Warning;
|
||||
@ -318,7 +319,7 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
writeElement("launchaltitude", cond.getLaunchAltitude());
|
||||
writeElement("launchlatitude", cond.getLaunchLatitude());
|
||||
writeElement("launchlongitude", cond.getLaunchLongitude());
|
||||
writeElement("geodeticmethod", cond.getGeodeticComputation().name().toLowerCase());
|
||||
writeElement("geodeticmethod", cond.getGeodeticComputation().name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (cond.isISAAtmosphere()) {
|
||||
writeln("<atmosphere model=\"isa\"/>");
|
||||
@ -553,7 +554,7 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
* @return the corresponding XML name.
|
||||
*/
|
||||
public static String enumToXMLName(Enum<?> e) {
|
||||
return e.name().toLowerCase().replace("_", "");
|
||||
return e.name().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -508,7 +509,7 @@ class DocumentConfig {
|
||||
return null;
|
||||
name = name.trim();
|
||||
for (Enum<T> e : enumClass.getEnumConstants()) {
|
||||
if (e.name().toLowerCase().replace("_", "").equals(name)) {
|
||||
if (e.name().toLowerCase(Locale.ENGLISH).replace("_", "").equals(name)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
@ -926,7 +927,7 @@ class MotorMountHandler extends AbstractElementHandler {
|
||||
if (element.equals("ignitionevent")) {
|
||||
MotorMount.IgnitionEvent event = null;
|
||||
for (MotorMount.IgnitionEvent e : MotorMount.IgnitionEvent.values()) {
|
||||
if (e.name().toLowerCase().replaceAll("_", "").equals(content)) {
|
||||
if (e.name().toLowerCase(Locale.ENGLISH).replaceAll("_", "").equals(content)) {
|
||||
event = e;
|
||||
break;
|
||||
}
|
||||
@ -1084,7 +1085,7 @@ class MotorHandler extends AbstractElementHandler {
|
||||
// Motor type
|
||||
type = null;
|
||||
for (Motor.Type t : Motor.Type.values()) {
|
||||
if (t.name().toLowerCase().equals(content.trim())) {
|
||||
if (t.name().toLowerCase(Locale.ENGLISH).equals(content.trim())) {
|
||||
type = t;
|
||||
break;
|
||||
}
|
||||
@ -1985,7 +1986,7 @@ class MaterialSetter implements Setter {
|
||||
|
||||
// Check type if specified
|
||||
str = attributes.remove("type");
|
||||
if (str != null && !type.name().toLowerCase().equals(str)) {
|
||||
if (str != null && !type.name().toLowerCase(Locale.ENGLISH).equals(str)) {
|
||||
warnings.add(Warning.fromString("Illegal material type specified, ignoring."));
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.ExternalComponent;
|
||||
|
||||
@ -11,10 +12,10 @@ public class ExternalComponentSaver extends RocketComponentSaver {
|
||||
protected void addParams(net.sf.openrocket.rocketcomponent.RocketComponent c, List<String> elements) {
|
||||
super.addParams(c, elements);
|
||||
|
||||
ExternalComponent ext = (ExternalComponent)c;
|
||||
ExternalComponent ext = (ExternalComponent) c;
|
||||
|
||||
// Finish enum names are currently the same except for case
|
||||
elements.add("<finish>" + ext.getFinish().name().toLowerCase() + "</finish>");
|
||||
elements.add("<finish>" + ext.getFinish().name().toLowerCase(Locale.ENGLISH) + "</finish>");
|
||||
|
||||
// Material
|
||||
elements.add(materialParam(ext.getMaterial()));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.util.MathUtil;
|
||||
|
||||
@ -14,18 +15,18 @@ public class FinSetSaver extends ExternalComponentSaver {
|
||||
elements.add("<fincount>" + fins.getFinCount() + "</fincount>");
|
||||
elements.add("<rotation>" + (fins.getBaseRotation() * 180.0 / Math.PI) + "</rotation>");
|
||||
elements.add("<thickness>" + fins.getThickness() + "</thickness>");
|
||||
elements.add("<crosssection>" + fins.getCrossSection().name().toLowerCase()
|
||||
elements.add("<crosssection>" + fins.getCrossSection().name().toLowerCase(Locale.ENGLISH)
|
||||
+ "</crosssection>");
|
||||
elements.add("<cant>" + (fins.getCantAngle() * 180.0 / Math.PI) + "</cant>");
|
||||
|
||||
// Save fin tabs only if they exist (compatibility with file version < 1.1)
|
||||
if (!MathUtil.equals(fins.getTabHeight(),0) &&
|
||||
if (!MathUtil.equals(fins.getTabHeight(), 0) &&
|
||||
!MathUtil.equals(fins.getTabLength(), 0)) {
|
||||
|
||||
elements.add("<tabheight>" + fins.getTabHeight() + "</tabheight>");
|
||||
elements.add("<tablength>" + fins.getTabLength() + "</tablength>");
|
||||
elements.add("<tabposition relativeto=\"" +
|
||||
fins.getTabRelativePosition().name().toLowerCase() + "\">" +
|
||||
fins.getTabRelativePosition().name().toLowerCase(Locale.ENGLISH) + "\">" +
|
||||
fins.getTabShift() + "</tabposition>");
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
|
||||
|
||||
@ -18,7 +19,7 @@ public class RecoveryDeviceSaver extends MassObjectSaver {
|
||||
else
|
||||
elements.add("<cd>" + dev.getCD() + "</cd>");
|
||||
|
||||
elements.add("<deployevent>" + dev.getDeployEvent().name().toLowerCase() + "</deployevent>");
|
||||
elements.add("<deployevent>" + dev.getDeployEvent().name().toLowerCase(Locale.ENGLISH) + "</deployevent>");
|
||||
elements.add("<deployaltitude>" + dev.getDeployAltitude() + "</deployaltitude>");
|
||||
elements.add("<deploydelay>" + dev.getDeployDelay() + "</deploydelay>");
|
||||
elements.add(materialParam(dev.getMaterial()));
|
||||
|
@ -3,6 +3,7 @@ package net.sf.openrocket.file.openrocket.savers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.file.RocketSaver;
|
||||
import net.sf.openrocket.material.Material;
|
||||
@ -38,7 +39,7 @@ public class RocketComponentSaver {
|
||||
LineStyle style = c.getLineStyle();
|
||||
if (style != null) {
|
||||
// Type names currently equivalent to the enum names except for case.
|
||||
elements.add("<linestyle>" + style.name().toLowerCase() + "</linestyle>");
|
||||
elements.add("<linestyle>" + style.name().toLowerCase(Locale.ENGLISH) + "</linestyle>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +47,7 @@ public class RocketComponentSaver {
|
||||
// Save position unless "AFTER"
|
||||
if (c.getRelativePosition() != RocketComponent.Position.AFTER) {
|
||||
// The type names are currently equivalent to the enum names except for case.
|
||||
String type = c.getRelativePosition().name().toLowerCase();
|
||||
String type = c.getRelativePosition().name().toLowerCase(Locale.ENGLISH);
|
||||
elements.add("<position type=\"" + type + "\">" + c.getPositionValue() + "</position>");
|
||||
}
|
||||
|
||||
@ -121,7 +122,7 @@ public class RocketComponentSaver {
|
||||
|
||||
elements.add(" <motor configid=\"" + id + "\">");
|
||||
if (motor.getMotorType() != Motor.Type.UNKNOWN) {
|
||||
elements.add(" <type>" + motor.getMotorType().name().toLowerCase() + "</type>");
|
||||
elements.add(" <type>" + motor.getMotorType().name().toLowerCase(Locale.ENGLISH) + "</type>");
|
||||
}
|
||||
if (motor instanceof ThrustCurveMotor) {
|
||||
ThrustCurveMotor m = (ThrustCurveMotor) motor;
|
||||
@ -144,7 +145,7 @@ public class RocketComponentSaver {
|
||||
}
|
||||
|
||||
elements.add(" <ignitionevent>"
|
||||
+ mount.getIgnitionEvent().name().toLowerCase().replace("_", "")
|
||||
+ mount.getIgnitionEvent().name().toLowerCase(Locale.ENGLISH).replace("_", "")
|
||||
+ "</ignitionevent>");
|
||||
|
||||
elements.add(" <ignitiondelay>" + mount.getIgnitionDelay() + "</ignitiondelay>");
|
||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.ReferenceType;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
@ -61,7 +62,7 @@ public class RocketSaver extends RocketComponentSaver {
|
||||
}
|
||||
|
||||
// Reference diameter
|
||||
elements.add("<referencetype>" + rocket.getReferenceType().name().toLowerCase()
|
||||
elements.add("<referencetype>" + rocket.getReferenceType().name().toLowerCase(Locale.ENGLISH)
|
||||
+ "</referencetype>");
|
||||
if (rocket.getReferenceType() == ReferenceType.CUSTOM) {
|
||||
elements.add("<customreference>" + rocket.getCustomReferenceLength()
|
||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.Stage;
|
||||
@ -27,7 +28,7 @@ public class StageSaver extends ComponentAssemblySaver {
|
||||
|
||||
if (stage.getStageNumber() > 0) {
|
||||
elements.add("<separationevent>"
|
||||
+ stage.getSeparationEvent().name().toLowerCase().replace("_", "")
|
||||
+ stage.getSeparationEvent().name().toLowerCase(Locale.ENGLISH).replace("_", "")
|
||||
+ "</separationevent>");
|
||||
elements.add("<separationdelay>" + stage.getSeparationDelay() + "</separationdelay>");
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.file.openrocket.savers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.NoseCone;
|
||||
import net.sf.openrocket.rocketcomponent.Transition;
|
||||
@ -33,7 +34,7 @@ public class TransitionSaver extends SymmetricComponentSaver {
|
||||
|
||||
|
||||
Transition.Shape shape = trans.getType();
|
||||
elements.add("<shape>" + shape.name().toLowerCase() + "</shape>");
|
||||
elements.add("<shape>" + shape.name().toLowerCase(Locale.ENGLISH) + "</shape>");
|
||||
if (shape.isClippable()) {
|
||||
elements.add("<shapeclipped>" + trans.isClipped() + "</shapeclipped>");
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import java.awt.event.FocusListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
@ -336,7 +337,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
panel.add(new StyledLabel(trans.get("RocketCompCfg.lbl.longB1") +
|
||||
//// The center of gravity is measured from the front end of the
|
||||
trans.get("RocketCompCfg.lbl.longB2") + " " +
|
||||
component.getComponentName().toLowerCase() + ".", -1),
|
||||
component.getComponentName().toLowerCase(Locale.getDefault()) + ".", -1),
|
||||
"spanx, wrap, gap para, height 0::30lp");
|
||||
|
||||
return panel;
|
||||
|
@ -14,6 +14,7 @@ import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
@ -333,7 +334,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
||||
String[] split = text.split("\\s+");
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for (String s : split) {
|
||||
s = s.trim().toLowerCase();
|
||||
s = s.trim().toLowerCase(Locale.getDefault());
|
||||
if (s.length() > 0) {
|
||||
list.add(s);
|
||||
}
|
||||
@ -943,7 +944,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
||||
public boolean filterByString(ThrustCurveMotorSet m) {
|
||||
main: for (String s : searchTerms) {
|
||||
for (ThrustCurveMotorColumns col : ThrustCurveMotorColumns.values()) {
|
||||
String str = col.getValue(m).toString().toLowerCase();
|
||||
String str = col.getValue(m).toString().toLowerCase(Locale.getDefault());
|
||||
if (str.indexOf(s) >= 0)
|
||||
continue main;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public enum PaperSize {
|
||||
return null;
|
||||
}
|
||||
|
||||
country = country.toUpperCase();
|
||||
country = country.toUpperCase(Locale.ENGLISH);
|
||||
for (String c : letterCountries) {
|
||||
if (c.equals(country)) {
|
||||
return LETTER;
|
||||
|
@ -5,6 +5,7 @@ import java.awt.event.ActionListener;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.EventObject;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
@ -23,10 +24,10 @@ public class ScaleSelector extends JPanel {
|
||||
private static final String ZOOM_FIT = "Fit";
|
||||
private static final String[] ZOOM_SETTINGS;
|
||||
static {
|
||||
ZOOM_SETTINGS = new String[ZOOM_LEVELS.length+1];
|
||||
for (int i=0; i<ZOOM_LEVELS.length; i++)
|
||||
ZOOM_SETTINGS = new String[ZOOM_LEVELS.length + 1];
|
||||
for (int i = 0; i < ZOOM_LEVELS.length; i++)
|
||||
ZOOM_SETTINGS[i] = PERCENT_FORMAT.format(ZOOM_LEVELS[i]);
|
||||
ZOOM_SETTINGS[ZOOM_SETTINGS.length-1] = ZOOM_FIT;
|
||||
ZOOM_SETTINGS[ZOOM_SETTINGS.length - 1] = ZOOM_FIT;
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +43,7 @@ public class ScaleSelector extends JPanel {
|
||||
// Zoom out button
|
||||
JButton button = new JButton(Icons.ZOOM_OUT);
|
||||
button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
double scale = scrollPane.getScaling();
|
||||
scale = getPreviousScale(scale);
|
||||
@ -53,19 +55,20 @@ public class ScaleSelector extends JPanel {
|
||||
// Zoom level selector
|
||||
String[] settings = ZOOM_SETTINGS;
|
||||
if (!scrollPane.isFittingAllowed()) {
|
||||
settings = Arrays.copyOf(settings, settings.length-1);
|
||||
settings = Arrays.copyOf(settings, settings.length - 1);
|
||||
}
|
||||
|
||||
zoomSelector = new JComboBox(settings);
|
||||
zoomSelector.setEditable(true);
|
||||
setZoomText();
|
||||
zoomSelector.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
String text = (String)zoomSelector.getSelectedItem();
|
||||
String text = (String) zoomSelector.getSelectedItem();
|
||||
text = text.replaceAll("%", "").trim();
|
||||
|
||||
if (text.toLowerCase().startsWith(ZOOM_FIT.toLowerCase()) &&
|
||||
if (text.toLowerCase(Locale.getDefault()).startsWith(ZOOM_FIT.toLowerCase(Locale.getDefault())) &&
|
||||
scrollPane.isFittingAllowed()) {
|
||||
scrollPane.setFitting(true);
|
||||
setZoomText();
|
||||
@ -91,19 +94,20 @@ public class ScaleSelector extends JPanel {
|
||||
setZoomText();
|
||||
}
|
||||
});
|
||||
add(zoomSelector,"gap rel");
|
||||
add(zoomSelector, "gap rel");
|
||||
|
||||
|
||||
// Zoom in button
|
||||
button = new JButton(Icons.ZOOM_IN);
|
||||
button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
double scale = scrollPane.getScaling();
|
||||
scale = getNextScale(scale);
|
||||
scrollPane.setScaling(scale);
|
||||
}
|
||||
});
|
||||
add(button,"gapleft rel");
|
||||
add(button, "gapleft rel");
|
||||
|
||||
}
|
||||
|
||||
@ -114,7 +118,7 @@ public class ScaleSelector extends JPanel {
|
||||
double zoom = scrollPane.getScaling();
|
||||
text = PERCENT_FORMAT.format(zoom);
|
||||
if (scrollPane.isFitting()) {
|
||||
text = "Fit ("+text+")";
|
||||
text = "Fit (" + text + ")";
|
||||
}
|
||||
if (!text.equals(zoomSelector.getSelectedItem()))
|
||||
zoomSelector.setSelectedItem(text);
|
||||
@ -124,32 +128,32 @@ public class ScaleSelector extends JPanel {
|
||||
|
||||
private double getPreviousScale(double scale) {
|
||||
int i;
|
||||
for (i=0; i<ZOOM_LEVELS.length-1; i++) {
|
||||
if (scale > ZOOM_LEVELS[i]+0.05 && scale < ZOOM_LEVELS[i+1]+0.05)
|
||||
for (i = 0; i < ZOOM_LEVELS.length - 1; i++) {
|
||||
if (scale > ZOOM_LEVELS[i] + 0.05 && scale < ZOOM_LEVELS[i + 1] + 0.05)
|
||||
return ZOOM_LEVELS[i];
|
||||
}
|
||||
if (scale > ZOOM_LEVELS[ZOOM_LEVELS.length/2]) {
|
||||
if (scale > ZOOM_LEVELS[ZOOM_LEVELS.length / 2]) {
|
||||
// scale is large, drop to next lowest full 100%
|
||||
scale = Math.ceil(scale-1.05);
|
||||
scale = Math.ceil(scale - 1.05);
|
||||
return Math.max(scale, ZOOM_LEVELS[i]);
|
||||
}
|
||||
// scale is small
|
||||
return scale/1.5;
|
||||
return scale / 1.5;
|
||||
}
|
||||
|
||||
|
||||
private double getNextScale(double scale) {
|
||||
int i;
|
||||
for (i=0; i<ZOOM_LEVELS.length-1; i++) {
|
||||
if (scale > ZOOM_LEVELS[i]-0.05 && scale < ZOOM_LEVELS[i+1]-0.05)
|
||||
return ZOOM_LEVELS[i+1];
|
||||
for (i = 0; i < ZOOM_LEVELS.length - 1; i++) {
|
||||
if (scale > ZOOM_LEVELS[i] - 0.05 && scale < ZOOM_LEVELS[i + 1] - 0.05)
|
||||
return ZOOM_LEVELS[i + 1];
|
||||
}
|
||||
if (scale > ZOOM_LEVELS[ZOOM_LEVELS.length/2]) {
|
||||
if (scale > ZOOM_LEVELS[ZOOM_LEVELS.length / 2]) {
|
||||
// scale is large, give next full 100%
|
||||
scale = Math.floor(scale+1.05);
|
||||
scale = Math.floor(scale + 1.05);
|
||||
return scale;
|
||||
}
|
||||
return scale*1.5;
|
||||
return scale * 1.5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.awt.Component;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JOptionPane;
|
||||
@ -60,7 +61,7 @@ public final class FileHelper {
|
||||
public static FileFilter getImageFileFilter() {
|
||||
String[] extensions = ImageIO.getReaderFileSuffixes();
|
||||
for (int i = 0; i < extensions.length; i++) {
|
||||
extensions[i] = extensions[i].toLowerCase();
|
||||
extensions[i] = extensions[i].toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
Arrays.sort(extensions);
|
||||
|
||||
@ -110,7 +111,7 @@ public final class FileHelper {
|
||||
*/
|
||||
public static File forceExtension(File original, String extension) {
|
||||
|
||||
if (!original.getName().toLowerCase().endsWith(extension.toLowerCase())) {
|
||||
if (!original.getName().toLowerCase(Locale.ENGLISH).endsWith(extension.toLowerCase(Locale.ENGLISH))) {
|
||||
log.debug(1, "File name does not contain extension, adding '" + extension + "'");
|
||||
String name = original.getAbsolutePath();
|
||||
if (extension.startsWith(".")) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.gui.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
@ -25,7 +26,7 @@ public class SimpleFileFilter extends FileFilter implements java.io.FileFilter {
|
||||
* @param description the description of this file filter.
|
||||
* @param extensions an array of extensions that match this filter.
|
||||
*/
|
||||
public SimpleFileFilter(String description, String ... extensions) {
|
||||
public SimpleFileFilter(String description, String... extensions) {
|
||||
this(description, true, extensions);
|
||||
}
|
||||
|
||||
@ -37,12 +38,12 @@ public class SimpleFileFilter extends FileFilter implements java.io.FileFilter {
|
||||
* @param acceptDir whether to accept directories
|
||||
* @param extensions an array of extensions that match this filter.
|
||||
*/
|
||||
public SimpleFileFilter(String description, boolean acceptDir, String ... extensions) {
|
||||
public SimpleFileFilter(String description, boolean acceptDir, String... extensions) {
|
||||
this.description = description;
|
||||
this.acceptDir = acceptDir;
|
||||
this.extensions = new String[extensions.length];
|
||||
for (int i=0; i<extensions.length; i++) {
|
||||
String ext = extensions[i].toLowerCase();
|
||||
for (int i = 0; i < extensions.length; i++) {
|
||||
String ext = extensions[i].toLowerCase(Locale.ENGLISH);
|
||||
if (ext.charAt(0) == '.') {
|
||||
this.extensions[i] = ext;
|
||||
} else {
|
||||
@ -60,8 +61,8 @@ public class SimpleFileFilter extends FileFilter implements java.io.FileFilter {
|
||||
return acceptDir;
|
||||
|
||||
String filename = file.getName();
|
||||
filename = filename.toLowerCase();
|
||||
for (String ext: extensions) {
|
||||
filename = filename.toLowerCase(Locale.ENGLISH);
|
||||
for (String ext : extensions) {
|
||||
if (filename.endsWith(ext))
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.sf.openrocket.logging;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The logging level. The natural order of the LogLevel orders the levels
|
||||
* from highest priority to lowest priority. Comparisons of the relative levels
|
||||
@ -103,7 +105,7 @@ public enum LogLevel {
|
||||
if (value == null) {
|
||||
return defaultLevel;
|
||||
}
|
||||
value = value.toUpperCase().trim();
|
||||
value = value.toUpperCase(Locale.ENGLISH).trim();
|
||||
|
||||
// Find the correct level
|
||||
LogLevel level = defaultLevel;
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -243,7 +244,7 @@ public class Manufacturer {
|
||||
|
||||
|
||||
private String generateSearchString(String str) {
|
||||
return str.toLowerCase().replaceAll("[^a-zA-Z0-9]+", " ").trim();
|
||||
return str.toLowerCase(Locale.getDefault()).replaceAll("[^a-zA-Z0-9]+", " ").trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.sf.openrocket.optimization.rocketoptimization.modifiers;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.logging.LogHelper;
|
||||
import net.sf.openrocket.optimization.general.OptimizationException;
|
||||
@ -53,7 +55,7 @@ public abstract class GenericModifier<T> extends AbstractSimulationModifier {
|
||||
}
|
||||
|
||||
try {
|
||||
methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
|
||||
methodName = methodName.substring(0, 1).toUpperCase(Locale.ENGLISH) + methodName.substring(1);
|
||||
getter = new Method(modifiedClass.getMethod("get" + methodName));
|
||||
setter = new Method(modifiedClass.getMethod("set" + methodName, double.class));
|
||||
} catch (SecurityException e) {
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
@ -273,8 +274,8 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
Transition.Shape shape = transition.getType();
|
||||
if (shape.usesParameter()) {
|
||||
SimulationModifier mod = new GenericComponentModifier(
|
||||
trans.get("optimization.modifier." + c.getClass().getSimpleName().toLowerCase() + ".shapeparameter"),
|
||||
trans.get("optimization.modifier." + c.getClass().getSimpleName().toLowerCase() + ".shapeparameter.desc"),
|
||||
trans.get("optimization.modifier." + c.getClass().getSimpleName().toLowerCase(Locale.ENGLISH) + ".shapeparameter"),
|
||||
trans.get("optimization.modifier." + c.getClass().getSimpleName().toLowerCase(Locale.ENGLISH) + ".shapeparameter.desc"),
|
||||
c, UnitGroup.UNITS_NONE,
|
||||
1.0, c.getClass(), c.getID(), "ShapeParameter");
|
||||
mod.setMinValue(shape.minParameter());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.simulation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
@ -188,7 +189,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
||||
* @return a data type.
|
||||
*/
|
||||
public static synchronized FlightDataType getType(String s, UnitGroup u) {
|
||||
FlightDataType type = EXISTING_TYPES.get(s.toLowerCase());
|
||||
FlightDataType type = EXISTING_TYPES.get(s.toLowerCase(Locale.ENGLISH));
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
@ -201,7 +202,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
||||
*/
|
||||
private static synchronized FlightDataType newType(String s, UnitGroup u, int priority) {
|
||||
FlightDataType type = new FlightDataType(s, u, priority);
|
||||
EXISTING_TYPES.put(s.toLowerCase(), type);
|
||||
EXISTING_TYPES.put(s.toLowerCase(Locale.ENGLISH), type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -220,7 +221,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
||||
this.name = typeName;
|
||||
this.units = units;
|
||||
this.priority = priority;
|
||||
this.hashCode = this.name.toLowerCase().hashCode();
|
||||
this.hashCode = this.name.toLowerCase(Locale.ENGLISH).hashCode();
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,16 @@ public class AbstractSimulationListener implements SimulationListener, Simulatio
|
||||
|
||||
//// SimulationListener ////
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMenuPosition() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSimulation(SimulationStatus status) throws SimulationException {
|
||||
// No-op
|
||||
|
@ -7,6 +7,25 @@ import net.sf.openrocket.simulation.exception.SimulationException;
|
||||
|
||||
public interface SimulationListener {
|
||||
|
||||
/**
|
||||
* Get the name of this simulation listener. Ideally this should be localized, as
|
||||
* it can be displayed in the UI.
|
||||
*
|
||||
* @return the name of this simulation listener.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
|
||||
/**
|
||||
* Get the menu position of this simulation listener. This should be an array
|
||||
* of localized submenu names in descending order, or an empty array for positioning
|
||||
* in the base menu.
|
||||
*
|
||||
* @return the menu position of this simulation listener.
|
||||
*/
|
||||
public String[] getMenuPosition();
|
||||
|
||||
|
||||
/**
|
||||
* Called when starting a simulation.
|
||||
*
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.startup;
|
||||
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
@ -59,8 +60,8 @@ public class VersionHelper {
|
||||
*/
|
||||
static void checkOpenJDK() {
|
||||
|
||||
if (System.getProperty("java.runtime.name", "").toLowerCase().indexOf("icedtea") >= 0 ||
|
||||
System.getProperty("java.vm.name", "").toLowerCase().indexOf("openjdk") >= 0) {
|
||||
if (System.getProperty("java.runtime.name", "").toLowerCase(Locale.ENGLISH).indexOf("icedtea") >= 0 ||
|
||||
System.getProperty("java.vm.name", "").toLowerCase(Locale.ENGLISH).indexOf("openjdk") >= 0) {
|
||||
|
||||
String jreName = System.getProperty("java.vm.name", "(unknown)");
|
||||
String jreVersion = System.getProperty("java.runtime.version", "(unknown)");
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.sf.openrocket.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
@ -141,14 +143,14 @@ public enum GeodeticComputationStrategy {
|
||||
* Return the name of this geodetic computation method.
|
||||
*/
|
||||
public String getName() {
|
||||
return trans.get(name().toLowerCase() + ".name");
|
||||
return trans.get(name().toLowerCase(Locale.ENGLISH) + ".name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a description of the geodetic computation methods.
|
||||
*/
|
||||
public String getDescription() {
|
||||
return trans.get(name().toLowerCase() + ".desc");
|
||||
return trans.get(name().toLowerCase(Locale.ENGLISH) + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,6 +14,7 @@ import java.net.URL;
|
||||
import java.security.Permission;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.openrocket.util.BugException;
|
||||
@ -149,21 +150,21 @@ public class HttpURLConnectionMock extends HttpURLConnection {
|
||||
@Override
|
||||
public void addRequestProperty(String key, String value) {
|
||||
assertFalse(connected);
|
||||
assertFalse(this.requestProperties.containsKey(key.toLowerCase()));
|
||||
this.requestProperties.put(key.toLowerCase(), value);
|
||||
assertFalse(this.requestProperties.containsKey(key.toLowerCase(Locale.ENGLISH)));
|
||||
this.requestProperties.put(key.toLowerCase(Locale.ENGLISH), value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRequestProperty(String key, String value) {
|
||||
assertFalse(connected);
|
||||
this.requestProperties.put(key.toLowerCase(), value);
|
||||
this.requestProperties.put(key.toLowerCase(Locale.ENGLISH), value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRequestProperty(String key) {
|
||||
return this.requestProperties.get(key.toLowerCase());
|
||||
return this.requestProperties.get(key.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
|
||||
@ -303,9 +304,6 @@ public class HttpURLConnectionMock extends HttpURLConnection {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void assertNull(Object o) {
|
||||
try {
|
||||
org.junit.Assert.assertNull(o);
|
||||
@ -351,19 +349,6 @@ public class HttpURLConnectionMock extends HttpURLConnection {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream getErrorStream() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user