Change toLowerCase() to toLowerCase(Locale.ENGLISH)
authorplaa <plaa@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 27 Mar 2012 11:42:31 +0000 (11:42 +0000)
committerplaa <plaa@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 27 Mar 2012 11:42:31 +0000 (11:42 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@488 180e2498-e6e9-4542-8430-84ac67f01cd8

28 files changed:
core/ChangeLog
core/src/net/sf/openrocket/arch/SystemInfo.java
core/src/net/sf/openrocket/communication/UpdateInfoRetriever.java
core/src/net/sf/openrocket/file/openrocket/OpenRocketSaver.java
core/src/net/sf/openrocket/file/openrocket/importt/OpenRocketLoader.java
core/src/net/sf/openrocket/file/openrocket/savers/ExternalComponentSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/FinSetSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/RecoveryDeviceSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/RocketComponentSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/RocketSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/StageSaver.java
core/src/net/sf/openrocket/file/openrocket/savers/TransitionSaver.java
core/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java
core/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java
core/src/net/sf/openrocket/gui/print/PaperSize.java
core/src/net/sf/openrocket/gui/scalefigure/ScaleSelector.java
core/src/net/sf/openrocket/gui/util/FileHelper.java
core/src/net/sf/openrocket/gui/util/SimpleFileFilter.java
core/src/net/sf/openrocket/logging/LogLevel.java
core/src/net/sf/openrocket/motor/Manufacturer.java
core/src/net/sf/openrocket/optimization/rocketoptimization/modifiers/GenericModifier.java
core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java
core/src/net/sf/openrocket/simulation/FlightDataType.java
core/src/net/sf/openrocket/simulation/listeners/AbstractSimulationListener.java
core/src/net/sf/openrocket/simulation/listeners/SimulationListener.java
core/src/net/sf/openrocket/startup/VersionHelper.java
core/src/net/sf/openrocket/util/GeodeticComputationStrategy.java
core/test/net/sf/openrocket/communication/HttpURLConnectionMock.java

index ab5e9e15220b94bd3fd901b5d45f6b9ac70810b5..9eb10c656dc455925dfc83b31868b8209ad19281 100644 (file)
@@ -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
index 7b526f2c484b78bb2c58e9f369b4e10eedaa32a2..316f313cc70f33d3edbb877900c8aaabd1c53901 100644 (file)
@@ -1,12 +1,13 @@
 package net.sf.openrocket.arch;
 
 import java.io.File;
+import java.util.Locale;
 
 import net.sf.openrocket.util.BugException;
 
 public class SystemInfo {
        
-
+       
        /**
         * Enumeration of supported operating systems.
         * 
@@ -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;
@@ -41,8 +42,8 @@ public class SystemInfo {
        }
        
        
-
-
+       
+       
        /**
         * Return the application data directory of this user.  The location depends
         * on the current platform.
index 3122f0859c310b68e6000c685d29e00a101a4f1a..017f6add3fa1272a7697ff2a15c372a3560a8723 100644 (file)
@@ -67,7 +67,7 @@ public class UpdateInfoRetriever {
        }
        
        
-
+       
        /**
         * Parse the data received from the server.
         * 
@@ -84,7 +84,7 @@ public class UpdateInfoRetriever {
                        reader = new BufferedReader(r);
                }
                
-
+               
                String version = null;
                ArrayList<ComparablePair<Integer, String>> updates =
                                new ArrayList<ComparablePair<Integer, String>>();
@@ -113,7 +113,7 @@ public class UpdateInfoRetriever {
        }
        
        
-
+       
        /**
         * An asynchronous task that fetches and parses the update info.
         * 
@@ -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;
@@ -223,7 +223,7 @@ public class UpdateInfoRetriever {
                                        return;
                                }
                                
-
+                               
                                info = new UpdateInfo(version, updates);
                                log.info("Found update: " + info);
                        } finally {
index 5b863158ad54cdda9e8f79777c49c9b58a72e4b1..b3b5999b359d2c739e96a81cb2a407d7f8214f34 100644 (file)
@@ -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("_", "");
        }
        
 }
index 313fa981a158d96206c6f9d2aa410e85e706020f..eee1dae68aadd6ae2daab91f0a45550134297cbb 100644 (file)
@@ -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;
                }
index 2f1b2a4ec14052222a773e0254c4c63fa894885f..5415832a7ea53810d667520b2fd43c026068f22d 100644 (file)
@@ -1,23 +1,24 @@
 package net.sf.openrocket.file.openrocket.savers;
 
 import java.util.List;
+import java.util.Locale;
 
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
 
 
 public class ExternalComponentSaver extends RocketComponentSaver {
-
+       
        @Override
        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()));
        }
-               
+       
 }
index 8756d89f72d1b7eefc3c646877682174a9cfbb53..7eaffc69334a59936b883478570e2dfbfe16148c 100644 (file)
@@ -1,34 +1,35 @@
 package net.sf.openrocket.file.openrocket.savers;
 
 import java.util.List;
+import java.util.Locale;
 
 import net.sf.openrocket.util.MathUtil;
 
 public class FinSetSaver extends ExternalComponentSaver {
-
+       
        @Override
        protected void addParams(net.sf.openrocket.rocketcomponent.RocketComponent c, List<String> elements) {
                super.addParams(c, elements);
-
+               
                net.sf.openrocket.rocketcomponent.FinSet fins = (net.sf.openrocket.rocketcomponent.FinSet) c;
                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>");
-               
+                       
                }
        }
-
+       
 }
index 22dcaa9cc2a11f53a3feaca7c02f415c729146f4..b4c4cc74ff844a2bae888b5a7f7f939e9dca62e6 100644 (file)
@@ -1,27 +1,28 @@
 package net.sf.openrocket.file.openrocket.savers;
 
 import java.util.List;
+import java.util.Locale;
 
 import net.sf.openrocket.rocketcomponent.RecoveryDevice;
 
 
 public class RecoveryDeviceSaver extends MassObjectSaver {
-
+       
        @Override
        protected void addParams(net.sf.openrocket.rocketcomponent.RocketComponent c, List<String> elements) {
                super.addParams(c, elements);
-
+               
                RecoveryDevice dev = (RecoveryDevice) c;
-
+               
                if (dev.isCDAutomatic())
                        elements.add("<cd>auto</cd>");
                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()));
        }
-
+       
 }
index 3cd29acb14de07113c8d0fb859b4dc47432e2d9f..bc58ff403f47e98de95ec30dce05348518e33433 100644 (file)
@@ -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;
@@ -26,7 +27,7 @@ public class RocketComponentSaver {
        protected void addParams(net.sf.openrocket.rocketcomponent.RocketComponent c, List<String> elements) {
                elements.add("<name>" + RocketSaver.escapeXML(c.getName()) + "</name>");
                
-
+               
                // Save color and line style if significant
                if (!(c instanceof Rocket || c instanceof ComponentAssembly)) {
                        Color color = c.getColor();
@@ -38,19 +39,19 @@ 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>");
                        }
                }
                
-
+               
                // 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>");
                }
                
-
+               
                // Overrides
                boolean overridden = false;
                if (c.isMassOverridden()) {
@@ -66,7 +67,7 @@ public class RocketComponentSaver {
                                        + "</overridesubcomponents>");
                }
                
-
+               
                // Comment
                if (c.getComment().length() > 0) {
                        elements.add("<comment>" + RocketSaver.escapeXML(c.getComment()) + "</comment>");
@@ -75,8 +76,8 @@ public class RocketComponentSaver {
        }
        
        
-
-
+       
+       
        protected final String materialParam(Material mat) {
                return materialParam("material", mat);
        }
@@ -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>");
index e8b7a345570222718d2b7186249b5f6dcca775cb..44d5599d2fecc584c7aa9c0de7fc20485f0f3bbf 100644 (file)
@@ -2,51 +2,52 @@ 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;
 
 
 public class RocketSaver extends RocketComponentSaver {
-
+       
        private static final RocketSaver instance = new RocketSaver();
-
+       
        public static ArrayList<String> getElements(net.sf.openrocket.rocketcomponent.RocketComponent c) {
                ArrayList<String> list = new ArrayList<String>();
-
+               
                list.add("<rocket>");
                instance.addParams(c, list);
                list.add("</rocket>");
-
+               
                return list;
        }
-
-
-
+       
+       
+       
        @Override
        protected void addParams(net.sf.openrocket.rocketcomponent.RocketComponent c, List<String> elements) {
                super.addParams(c, elements);
-
+               
                Rocket rocket = (Rocket) c;
                
                if (rocket.getDesigner().length() > 0) {
-                       elements.add("<designer>" 
+                       elements.add("<designer>"
                                        + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getDesigner())
                                        + "</designer>");
                }
                if (rocket.getRevision().length() > 0) {
-                       elements.add("<revision>" 
-                                       + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getRevision()) 
+                       elements.add("<revision>"
+                                       + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getRevision())
                                        + "</revision>");
                }
-
-
+               
+               
                // Motor configurations
                String defId = rocket.getDefaultConfiguration().getMotorConfigurationID();
                for (String id : rocket.getMotorConfigurationIDs()) {
                        if (id == null)
                                continue;
-
+                       
                        String str = "<motorconfiguration configid=\"" + id + "\"";
                        if (id.equals(defId))
                                str += " default=\"true\"";
@@ -55,19 +56,19 @@ public class RocketSaver extends RocketComponentSaver {
                                str += "/>";
                        } else {
                                str += "><name>" + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getMotorConfigurationName(id))
-                                       + "</name></motorconfiguration>";
+                                               + "</name></motorconfiguration>";
                        }
                        elements.add(str);
                }
                
                // 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()
                                        + "</customreference>");
                }
-
+               
        }
-
+       
 }
index e0b1b58dc13a7b3cb1e94a9d32eba3b4a4310a77..23f591f313ea445e4a0a19295799692f65704b6e 100644 (file)
@@ -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>");
                }
index d7bb1ed7b0cb8d5e75f8982e7c5428f20cbe4058..0a4169f9e143880a826161c77b666306b86a89ff 100644 (file)
@@ -2,26 +2,27 @@ 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;
 
 
 public class TransitionSaver extends SymmetricComponentSaver {
-
+       
        private static final TransitionSaver instance = new TransitionSaver();
-
+       
        public static ArrayList<String> getElements(net.sf.openrocket.rocketcomponent.RocketComponent c) {
                ArrayList<String> list = new ArrayList<String>();
-
+               
                list.add("<transition>");
                instance.addParams(c, list);
                list.add("</transition>");
-
+               
                return list;
        }
-
-
+       
+       
        /*
         * Note:  This method must be capable of handling nose cones as well.
         */
@@ -30,31 +31,31 @@ public class TransitionSaver extends SymmetricComponentSaver {
                super.addParams(c, elements);
                net.sf.openrocket.rocketcomponent.Transition trans = (net.sf.openrocket.rocketcomponent.Transition) c;
                boolean nosecone = (trans instanceof NoseCone);
-
-
+               
+               
                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>");
                }
                if (shape.usesParameter()) {
                        elements.add("<shapeparameter>" + trans.getShapeParameter() + "</shapeparameter>");
                }
-
-
+               
+               
                if (!nosecone) {
                        if (trans.isForeRadiusAutomatic())
                                elements.add("<foreradius>auto</foreradius>");
                        else
                                elements.add("<foreradius>" + trans.getForeRadius() + "</foreradius>");
                }
-
+               
                if (trans.isAftRadiusAutomatic())
                        elements.add("<aftradius>auto</aftradius>");
                else
                        elements.add("<aftradius>" + trans.getAftRadius() + "</aftradius>");
-
-
+               
+               
                if (!nosecone) {
                        elements.add("<foreshoulderradius>" + trans.getForeShoulderRadius()
                                        + "</foreshoulderradius>");
@@ -65,7 +66,7 @@ public class TransitionSaver extends SymmetricComponentSaver {
                        elements.add("<foreshouldercapped>" + trans.isForeShoulderCapped()
                                        + "</foreshouldercapped>");
                }
-
+               
                elements.add("<aftshoulderradius>" + trans.getAftShoulderRadius()
                                + "</aftshoulderradius>");
                elements.add("<aftshoulderlength>" + trans.getAftShoulderLength()
@@ -75,5 +76,5 @@ public class TransitionSaver extends SymmetricComponentSaver {
                elements.add("<aftshouldercapped>" + trans.isAftShoulderCapped()
                                + "</aftshouldercapped>");
        }
-
+       
 }
index 95853b0246602b28cf8708123bbd2a2711e0773c..2a782d1513515c3370e5d88038f30b70d80f5483 100644 (file)
@@ -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;
@@ -60,7 +61,7 @@ public class RocketComponentConfig extends JPanel {
        
        private final List<Invalidatable> invalidatables = new ArrayList<Invalidatable>();
        
-
+       
        protected final JTextField componentNameField;
        protected JTextArea commentTextArea;
        private final TextFieldListener textFieldListener;
@@ -90,7 +91,7 @@ public class RocketComponentConfig extends JPanel {
                componentNameField.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname"));
                this.add(componentNameField, "growx, growy 0, wrap");
                
-
+               
                tabbedPane = new JTabbedPane();
                this.add(tabbedPane, "growx, growy 1, wrap");
                
@@ -207,7 +208,7 @@ public class RocketComponentConfig extends JPanel {
                combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
                panel.add(combo, "spanx 4, growx, wrap paragraph");
                
-
+               
                if (component instanceof ExternalComponent) {
                        label = new JLabel(finishString);
                        ////<html>The component finish affects the aerodynamic drag of the component.<br>
@@ -286,7 +287,7 @@ public class RocketComponentConfig extends JPanel {
                bm.addEnableComponent(bs);
                panel.add(bs, "growx 5, w 100lp, wrap");
                
-
+               
                ////  CG override
                bm = new BooleanModel(component, "CGOverridden");
                check = new JCheckBox(bm);
@@ -324,7 +325,7 @@ public class RocketComponentConfig extends JPanel {
                bm.addEnableComponent(bs);
                panel.add(bs, "growx 5, w 100lp, wrap 35lp");
                
-
+               
                // Override subcomponents checkbox
                bm = new BooleanModel(component, "OverrideSubcomponents");
                check = new JCheckBox(bm);
@@ -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;
@@ -364,7 +365,7 @@ public class RocketComponentConfig extends JPanel {
        }
        
        
-
+       
        private JPanel figureTab() {
                JPanel panel = new JPanel(new MigLayout("align 20% 20%"));
                
@@ -384,7 +385,7 @@ public class RocketComponentConfig extends JPanel {
                                }
                                
                                //// Choose color
-                               Color awtColor = ColorConversion.toAwtColor(c); 
+                               Color awtColor = ColorConversion.toAwtColor(c);
                                awtColor = JColorChooser.showDialog(tabbedPane, trans.get("RocketCompCfg.lbl.Choosecolor"), awtColor);
                                c = ColorConversion.fromAwtColor(awtColor);
                                if (c != null) {
@@ -450,7 +451,7 @@ public class RocketComponentConfig extends JPanel {
        }
        
        
-
+       
        protected JPanel shoulderTab() {
                JPanel panel = new JPanel(new MigLayout("fill"));
                JPanel sub;
@@ -460,7 +461,7 @@ public class RocketComponentConfig extends JPanel {
                JCheckBox check;
                JSpinner spin;
                
-
+               
                ////  Fore shoulder, not for NoseCone
                
                if (!(component instanceof NoseCone)) {
@@ -469,7 +470,7 @@ public class RocketComponentConfig extends JPanel {
                        //// Fore shoulder
                        sub.setBorder(BorderFactory.createTitledBorder(trans.get("RocketCompCfg.border.Foreshoulder")));
                        
-
+                       
                        ////  Radius
                        //// Diameter:
                        sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Diameter")));
@@ -484,7 +485,7 @@ public class RocketComponentConfig extends JPanel {
                        sub.add(new UnitSelector(m), "growx");
                        sub.add(new BasicSlider(m.getSliderModel(m0, m2)), "w 100lp, wrap");
                        
-
+                       
                        ////  Length:
                        sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Length")));
                        
@@ -497,7 +498,7 @@ public class RocketComponentConfig extends JPanel {
                        sub.add(new UnitSelector(m), "growx");
                        sub.add(new BasicSlider(m.getSliderModel(0, 0.02, 0.2)), "w 100lp, wrap");
                        
-
+                       
                        ////  Thickness:
                        sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Thickness")));
                        
@@ -511,7 +512,7 @@ public class RocketComponentConfig extends JPanel {
                        sub.add(new UnitSelector(m), "growx");
                        sub.add(new BasicSlider(m.getSliderModel(m0, m2)), "w 100lp, wrap");
                        
-
+                       
                        ////  Capped
                        bm = new BooleanModel(component, "ForeShoulderCapped");
                        check = new JCheckBox(bm);
@@ -521,11 +522,11 @@ public class RocketComponentConfig extends JPanel {
                        check.setToolTipText(trans.get("RocketCompCfg.ttip.Endcapped"));
                        sub.add(check, "spanx");
                        
-
+                       
                        panel.add(sub);
                }
                
-
+               
                ////  Aft shoulder
                sub = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
                
@@ -536,7 +537,7 @@ public class RocketComponentConfig extends JPanel {
                        //// Aft shoulder
                        sub.setBorder(BorderFactory.createTitledBorder(trans.get("RocketCompCfg.title.Aftshoulder")));
                
-
+               
                ////  Radius
                //// Diameter:
                sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Diameter")));
@@ -551,7 +552,7 @@ public class RocketComponentConfig extends JPanel {
                sub.add(new UnitSelector(m), "growx");
                sub.add(new BasicSlider(m.getSliderModel(m0, m2)), "w 100lp, wrap");
                
-
+               
                ////  Length:
                sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Length")));
                
@@ -564,7 +565,7 @@ public class RocketComponentConfig extends JPanel {
                sub.add(new UnitSelector(m), "growx");
                sub.add(new BasicSlider(m.getSliderModel(0, 0.02, 0.2)), "w 100lp, wrap");
                
-
+               
                ////  Thickness:
                sub.add(new JLabel(trans.get("RocketCompCfg.lbl.Thickness")));
                
@@ -578,7 +579,7 @@ public class RocketComponentConfig extends JPanel {
                sub.add(new UnitSelector(m), "growx");
                sub.add(new BasicSlider(m.getSliderModel(m0, m2)), "w 100lp, wrap");
                
-
+               
                ////  Capped
                bm = new BooleanModel(component, "AftShoulderCapped");
                check = new JCheckBox(bm);
@@ -588,16 +589,16 @@ public class RocketComponentConfig extends JPanel {
                check.setToolTipText(trans.get("RocketCompCfg.ttip.Endcapped"));
                sub.add(check, "spanx");
                
-
+               
                panel.add(sub);
                
-
+               
                return panel;
        }
        
        
-
-
+       
+       
        /*
         * Private inner class to handle events in componentNameField.
         */
index 8e6fe5d6d71955114aec1eb5f156fe7440e02c06..2600cff380ab809f33077da41f7e3bfc09080c7e 100644 (file)
@@ -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;
                                }
index d3d07410570570791288f481d48ff3e4b3aa21f0..1908fa281d88251cebf39c837fe872eedc093188 100644 (file)
@@ -36,7 +36,7 @@ public enum PaperSize {
        }
        
        
-
+       
        //////////////////////////
        
        private static final LogHelper log = Application.getLogger();
@@ -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;
index 1e966a05ead4b1bb352f55130225f7b1e1fb4611..d8a0b7634106174d941126b525c5311cebeed140 100644 (file)
@@ -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;
@@ -15,18 +16,18 @@ import net.sf.openrocket.gui.util.Icons;
 import net.sf.openrocket.util.StateChangeListener;
 
 public class ScaleSelector extends JPanel {
-
+       
        // Ready zoom settings
        private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("0.#%");
-
-       private static final double[] ZOOM_LEVELS = { 0.15, 0.25, 0.5, 0.75, 1.0, 1.5, 2.0 }; 
+       
+       private static final double[] ZOOM_LEVELS = { 0.15, 0.25, 0.5, 0.75, 1.0, 1.5, 2.0 };
        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;
        }
        
        
@@ -36,12 +37,13 @@ public class ScaleSelector extends JPanel {
        
        public ScaleSelector(ScaleScrollPane scroll) {
                super(new MigLayout());
-
+               
                this.scrollPane = scroll;
                
                // 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);
@@ -49,34 +51,35 @@ public class ScaleSelector extends JPanel {
                        }
                });
                add(button, "gap");
-
+               
                // 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();
                                                return;
                                        }
-
+                                       
                                        double n = Double.parseDouble(text);
                                        n /= 100;
                                        if (n <= 0.005)
                                                n = 0.005;
-
+                                       
                                        scrollPane.setScaling(n);
                                        setZoomText();
                                } catch (NumberFormatException ignore) {
@@ -91,65 +94,66 @@ 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");
+               
+       }
+       
+       
        
-
        private void setZoomText() {
                String text;
                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);
        }
        
-
+       
        
        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;
        }
        
 }
index 860379ed48bdb4f962cb973e7bdc9f33929eaac4..937be15281839273c6a36945f1ec6b7b3d70d346 100644 (file)
@@ -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(".")) {
index 39ded917956f48ffca6e2c54935d56918a0a0ce6..e895b9299d490c46d9b33aca661ab460e60314d9 100644 (file)
@@ -1,6 +1,7 @@
 package net.sf.openrocket.gui.util;
 
 import java.io.File;
+import java.util.Locale;
 
 import javax.swing.filechooser.FileFilter;
 
@@ -12,7 +13,7 @@ import javax.swing.filechooser.FileFilter;
  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
  */
 public class SimpleFileFilter extends FileFilter implements java.io.FileFilter {
-
+       
        private final String description;
        private final boolean acceptDir;
        private final String[] extensions;
@@ -25,11 +26,11 @@ 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);
        }
        
-
+       
        /**
         * Create filter that accepts files with the provided 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,18 +61,18 @@ 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;
                }
                
                return false;
        }
-
+       
        @Override
        public String getDescription() {
                return description;
        }
-
+       
 }
index b52d14536a383c6bf1aa18d1092b8517298d127a..a57838560b67f7d2689e8c30ff0b5091d25925a0 100644 (file)
@@ -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
@@ -16,13 +18,13 @@ public enum LogLevel {
         * No ERROR level events _should_ occur while running the program.
         */
        ERROR,
-
+       
        /** 
         * Level for indicating error conditions or atypical events that can occur during
         * normal operation (errors while loading files, weird computation results etc).
         */
        WARN,
-
+       
        /** 
         * Level for logging user actions (adding and modifying components, running
         * simulations etc).  A user action should be logged as soon as possible on this
@@ -30,13 +32,13 @@ public enum LogLevel {
         * user actions from a bounded log buffer.
         */
        USER,
-
+       
        /**
         * Level for indicating general level actions the software is performing and
         * other notable events during execution (dialogs shown, simulations run etc).
         */
        INFO,
-
+       
        /**
         * Level for indicating mid-results, outcomes of methods and other debugging 
         * information.  The data logged should be of value when analyzing error
@@ -44,7 +46,7 @@ public enum LogLevel {
         * during e.g. flight simulation should use the VBOSE level instead.
         */
        DEBUG,
-
+       
        /**
         * Level of verbose debug logging to be used in areas which are called repeatedly,
         * such as computational methods used in simulations.  This level is separated to
@@ -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;
index 831181bbfae3033dd04a38b6c2345243ad15ed3b..d61d56f8b504589bb2c90279b4cc49885fc8c68a 100644 (file)
@@ -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;
 
 /**
@@ -98,7 +99,7 @@ public class Manufacturer {
                                "WECO", "WECO FEUERWERKS", "SF", "SACHSEN", "SACHSEN FEUERWERK",
                                "SACHSEN FEUERWERKS"));
                
-
+               
                // Check that no duplicates have appeared
                for (Manufacturer m1 : manufacturers) {
                        for (Manufacturer m2 : manufacturers) {
@@ -114,8 +115,8 @@ public class Manufacturer {
                }
        }
        
-
-
+       
+       
        private final String displayName;
        private final String simpleName;
        private final Set<String> allNames;
@@ -240,10 +241,10 @@ 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();
        }
        
 }
index 07724c8fd4c6b3586a3c408051ba8d573fefd53b..b5e2eaee4d507ebb9b73754d216404a3f7f68023 100644 (file)
@@ -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) {
@@ -64,7 +66,7 @@ public abstract class GenericModifier<T> extends AbstractSimulationModifier {
        }
        
        
-
+       
        @Override
        public double getCurrentSIValue(Simulation simulation) throws OptimizationException {
                T modifiable = getModifiedObject(simulation);
@@ -97,7 +99,7 @@ public abstract class GenericModifier<T> extends AbstractSimulationModifier {
        protected abstract T getModifiedObject(Simulation simulation) throws OptimizationException;
        
        
-
+       
        @Override
        public String toString() {
                return "GenericModifier[modifiedClass=" + modifiedClass.getCanonicalName() + ", methodName=" + methodName + ", multiplier=" + multiplier + "]";
index 565330aae1b25d7f36ee4a7408b6aca0e23b96d0..cf77e3c579bd14a25ef0b69edb3f48dcd67209e6 100644 (file)
@@ -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;
@@ -41,7 +42,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
        
        private static final double DEFAULT_RANGE_MULTIPLIER = 2.0;
        
-
+       
        private static final Map<Class<?>, List<ModifierDefinition>> definitions = new HashMap<Class<?>, List<ModifierDefinition>>();
        static {
                //addModifier("optimization.modifier.", unitGroup, multiplier, componentClass, methodName);
@@ -51,7 +52,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                 * For example, body tube does not have inner diameter definition because it is
                 * defined by the outer diameter and thickness.
                 */
-
+               
                addModifier("optimization.modifier.nosecone.length", UnitGroup.UNITS_LENGTH, 1.0, NoseCone.class, "Length");
                addModifier("optimization.modifier.nosecone.diameter", UnitGroup.UNITS_LENGTH, 2.0, NoseCone.class, "AftRadius", "isAftRadiusAutomatic");
                addModifier("optimization.modifier.nosecone.thickness", UnitGroup.UNITS_LENGTH, 1.0, NoseCone.class, "Thickness", "isFilled");
@@ -81,7 +82,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                addModifier("optimization.modifier.launchlug.outerDiameter", UnitGroup.UNITS_LENGTH, 2.0, LaunchLug.class, "OuterRadius");
                addModifier("optimization.modifier.launchlug.thickness", UnitGroup.UNITS_LENGTH, 1.0, LaunchLug.class, "Thickness");
                
-
+               
                addModifier("optimization.modifier.masscomponent.mass", UnitGroup.UNITS_MASS, 1.0, MassComponent.class, "ComponentMass");
                
                addModifier("optimization.modifier.parachute.diameter", UnitGroup.UNITS_LENGTH, 1.0, Parachute.class, "Diameter");
@@ -100,7 +101,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
        }
        
        private static void addModifier(String modifierNameKey, UnitGroup unitGroup, double multiplier,
-                               Class<? extends RocketComponent> componentClass, String methodName, String autoMethod) {
+                       Class<? extends RocketComponent> componentClass, String methodName, String autoMethod) {
                
                String modifierDescriptionKey = modifierNameKey + ".desc";
                
@@ -116,8 +117,8 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
        }
        
        
-
-
+       
+       
        @Override
        public Collection<SimulationModifier> getModifiers(OpenRocketDocument document) {
                List<SimulationModifier> modifiers = new ArrayList<SimulationModifier>();
@@ -151,7 +152,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                }
                        }
                        
-
+                       
                        // Add override modifiers if mass/CG is overridden
                        if (c.isMassOverridden()) {
                                SimulationModifier mod = new GenericComponentModifier(
@@ -173,7 +174,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                modifiers.add(mod);
                        }
                        
-
+                       
                        // Conditional motor mount parameters
                        if (c instanceof MotorMount) {
                                MotorMount mount = (MotorMount) c;
@@ -199,7 +200,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                }
                        }
                        
-
+                       
                        // Inner component positioning
                        if (c instanceof InternalComponent) {
                                RocketComponent parent = c.getParent();
@@ -213,7 +214,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                modifiers.add(mod);
                        }
                        
-
+                       
                        // Custom min/max for fin set position
                        if (c instanceof FinSet) {
                                RocketComponent parent = c.getParent();
@@ -227,7 +228,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                modifiers.add(mod);
                        }
                        
-
+                       
                        // Custom min/max for launch lug position
                        if (c instanceof LaunchLug) {
                                RocketComponent parent = c.getParent();
@@ -241,7 +242,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                modifiers.add(mod);
                        }
                        
-
+                       
                        // Recovery device deployment altitude and delay
                        if (c instanceof RecoveryDevice) {
                                RecoveryDevice device = (RecoveryDevice) c;
@@ -266,15 +267,15 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
                                }
                        }
                        
-
+                       
                        // Conditional shape parameter of Transition
                        if (c instanceof Transition) {
                                Transition transition = (Transition) c;
                                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());
@@ -303,7 +304,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
         * String modifierName, Object relatedObject, UnitGroup unitGroup,
                        double multiplier, Class<? extends RocketComponent> componentClass, String componentId, String methodName
         */
-
+       
        private static class ModifierDefinition {
                private final String modifierNameKey;
                private final String modifierDescriptionKey;
index 26862420cd9b1cd0e70b4fecccb1ef17ef548e64..0e8b41a428a6d9b1d67d47370a9720378455d588 100644 (file)
@@ -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;
@@ -29,12 +30,12 @@ public class FlightDataType implements Comparable<FlightDataType> {
        /** List of existing types.  MUST BE DEFINED BEFORE ANY TYPES!! */
        private static final Map<String, FlightDataType> EXISTING_TYPES = new HashMap<String, FlightDataType>();
        
-
-
+       
+       
        //// Time
        public static final FlightDataType TYPE_TIME = newType(trans.get("FlightDataType.TYPE_TIME"), UnitGroup.UNITS_FLIGHT_TIME, 1);
        
-
+       
        //// Vertical position and motion
        //// Altitude
        public static final FlightDataType TYPE_ALTITUDE = newType(trans.get("FlightDataType.TYPE_ALTITUDE"), UnitGroup.UNITS_DISTANCE, 10);
@@ -43,14 +44,14 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Vertical acceleration
        public static final FlightDataType TYPE_ACCELERATION_Z = newType(trans.get("FlightDataType.TYPE_ACCELERATION_Z"), UnitGroup.UNITS_ACCELERATION, 12);
        
-
+       
        //// Total motion
        //// Total velocity
        public static final FlightDataType TYPE_VELOCITY_TOTAL = newType(trans.get("FlightDataType.TYPE_VELOCITY_TOTAL"), UnitGroup.UNITS_VELOCITY, 20);
        //// Total acceleration
        public static final FlightDataType TYPE_ACCELERATION_TOTAL = newType(trans.get("FlightDataType.TYPE_ACCELERATION_TOTAL"), UnitGroup.UNITS_ACCELERATION, 21);
        
-
+       
        //// Lateral position and motion
        //// Position upwind
        public static final FlightDataType TYPE_POSITION_X = newType(trans.get("FlightDataType.TYPE_POSITION_X"), UnitGroup.UNITS_DISTANCE, 30);
@@ -79,7 +80,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Yaw rate
        public static final FlightDataType TYPE_YAW_RATE = newType(trans.get("FlightDataType.TYPE_YAW_RATE"), UnitGroup.UNITS_ROLL, 43);
        
-
+       
        //// Stability information
        //// Mass
        public static final FlightDataType TYPE_MASS = newType(trans.get("FlightDataType.TYPE_MASS"), UnitGroup.UNITS_MASS, 50);
@@ -94,14 +95,14 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Stability margin calibers
        public static final FlightDataType TYPE_STABILITY = newType(trans.get("FlightDataType.TYPE_STABILITY"), UnitGroup.UNITS_COEFFICIENT, 55);
        
-
+       
        //// Characteristic numbers
        //// Mach number
        public static final FlightDataType TYPE_MACH_NUMBER = newType(trans.get("FlightDataType.TYPE_MACH_NUMBER"), UnitGroup.UNITS_COEFFICIENT, 60);
        //// Reynolds number
        public static final FlightDataType TYPE_REYNOLDS_NUMBER = newType(trans.get("FlightDataType.TYPE_REYNOLDS_NUMBER"), UnitGroup.UNITS_COEFFICIENT, 61);
        
-
+       
        //// Thrust and drag
        //// Thrust
        public static final FlightDataType TYPE_THRUST_FORCE = newType(trans.get("FlightDataType.TYPE_THRUST_FORCE"), UnitGroup.UNITS_FORCE, 70);
@@ -112,7 +113,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Axial drag coefficient
        public static final FlightDataType TYPE_AXIAL_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_AXIAL_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 73);
        
-
+       
        ////  Component drag coefficients
        //// Friction drag coefficient
        public static final FlightDataType TYPE_FRICTION_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_FRICTION_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 80);
@@ -121,7 +122,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Base drag coefficient
        public static final FlightDataType TYPE_BASE_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_BASE_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 82);
        
-
+       
        ////  Other coefficients
        //// Normal force coefficient
        public static final FlightDataType TYPE_NORMAL_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_NORMAL_FORCE_COEFF"), UnitGroup.UNITS_COEFFICIENT, 90);
@@ -146,21 +147,21 @@ public class FlightDataType implements Comparable<FlightDataType> {
        //// Coriolis acceleration
        public static final FlightDataType TYPE_CORIOLIS_ACCELERATION = newType(trans.get("FlightDataType.TYPE_CORIOLIS_ACCELERATION"), UnitGroup.UNITS_ACCELERATION, 99);
        
-
+       
        ////  Reference length + area
        //// Reference length
        public static final FlightDataType TYPE_REFERENCE_LENGTH = newType(trans.get("FlightDataType.TYPE_REFERENCE_LENGTH"), UnitGroup.UNITS_LENGTH, 100);
        //// Reference area
        public static final FlightDataType TYPE_REFERENCE_AREA = newType(trans.get("FlightDataType.TYPE_REFERENCE_AREA"), UnitGroup.UNITS_AREA, 101);
        
-
+       
        ////  Orientation
        //// Vertical orientation (zenith)
        public static final FlightDataType TYPE_ORIENTATION_THETA = newType(trans.get("FlightDataType.TYPE_ORIENTATION_THETA"), UnitGroup.UNITS_ANGLE, 106);
        //// Lateral orientation (azimuth)
        public static final FlightDataType TYPE_ORIENTATION_PHI = newType(trans.get("FlightDataType.TYPE_ORIENTATION_PHI"), UnitGroup.UNITS_ANGLE, 107);
        
-
+       
        ////  Atmospheric conditions
        //// Wind velocity
        public static final FlightDataType TYPE_WIND_VELOCITY = newType(trans.get("FlightDataType.TYPE_WIND_VELOCITY"), UnitGroup.UNITS_VELOCITY, 110);
@@ -178,7 +179,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
        public static final FlightDataType TYPE_COMPUTATION_TIME = newType(trans.get("FlightDataType.TYPE_COMPUTATION_TIME"), UnitGroup.UNITS_SHORT_TIME, 201);
        
        
-
+       
        /**
         * Return a {@link FlightDataType} based on a string description.  This returns known data types
         * if possible, or a new type otherwise.
@@ -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,12 +221,12 @@ 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();
        }
        
        
-
-
+       
+       
        public String getName() {
                return name;
        }
index ebb2ad94c3ec8cedab38e43596e955da5afce56c..a3a3b19279626a47161bac3f023faa9fba62617f 100644 (file)
@@ -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
@@ -58,8 +68,8 @@ public class AbstractSimulationListener implements SimulationListener, Simulatio
        }
        
        
-
-
+       
+       
        ////  SimulationEventListener  ////
        
        @Override
@@ -83,7 +93,7 @@ public class AbstractSimulationListener implements SimulationListener, Simulatio
        }
        
        
-
+       
        ////  SimulationComputationListener  ////
        
        @Override
index 98b28aada2846690c6daf67f6171d6b5ba05347c..d5663ccbdc05441112f4bbcfed37627c23d0f4c9 100644 (file)
@@ -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.
         * 
index 097f1dc43c2d64ce6f16ced5dff95e04ce89cb25..0b3d91829e309d0ce9719a7646b1d15c39bf3750 100644 (file)
@@ -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)");
@@ -79,7 +80,7 @@ public class VersionHelper {
        }
        
        
-
+       
        ///////////  Helper methods  //////////
        
        /**
@@ -97,7 +98,7 @@ public class VersionHelper {
                }
                System.err.println();
                
-
+               
                if (!GraphicsEnvironment.isHeadless()) {
                        
                        JOptionPane.showMessageDialog(null, message, "Error starting OpenRocket",
index f8a37a09dd5bc848966eb2bd98f71acf889b10f6..0721e893d1ef08048925fd18b1ad3d8695328138 100644 (file)
@@ -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;
 
@@ -13,7 +15,7 @@ import net.sf.openrocket.startup.Application;
  */
 public enum GeodeticComputationStrategy {
        
-
+       
        /**
         * Perform computations using a flat Earth approximation.  addCoordinate computes the
         * location using a direct meters-per-degree scaling and getCoriolisAcceleration always
@@ -131,7 +133,7 @@ public enum GeodeticComputationStrategy {
                }
        };
        
-
+       
        private static final Translator trans = Application.getTranslator();
        
        private static final double PRECISION_LIMIT = 0.5e-13;
@@ -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
@@ -169,9 +171,9 @@ public enum GeodeticComputationStrategy {
        public abstract Coordinate getCoriolisAcceleration(WorldCoordinate location, Coordinate velocity);
        
        
-
-
-
+       
+       
+       
        private static Coordinate computeCoriolisAcceleration(WorldCoordinate latlon, Coordinate velocity) {
                
                double sinlat = Math.sin(latlon.getLatitudeRad());
@@ -189,14 +191,14 @@ public enum GeodeticComputationStrategy {
                // able to be set independently and in terms of bearing with north == +ve y.
                
                Coordinate coriolis = new Coordinate(2.0 * WorldCoordinate.EROT * (v_n * sinlat - v_u * coslat),
-                                                                                               2.0 * WorldCoordinate.EROT * (-1.0 * v_e * sinlat),
-                                                                                               2.0 * WorldCoordinate.EROT * (v_e * coslat)
-                                                                                       );
+                               2.0 * WorldCoordinate.EROT * (-1.0 * v_e * sinlat),
+                               2.0 * WorldCoordinate.EROT * (v_e * coslat)
+                               );
                return coriolis;
        }
        
        
-
+       
        // ******************************************************************** //
        // The Vincenty Direct Solution.
        // Code from GeoConstants.java, Ian Cameron Smith, GPL
@@ -226,8 +228,8 @@ public enum GeodeticComputationStrategy {
         *                                              point, in radians clockwise from north.
         */
        private static double[] dirct1(double glat1, double glon1,
-                                                                       double azimuth, double dist,
-                                                                       double axis, double flat) {
+                       double azimuth, double dist,
+                       double axis, double flat) {
                double r = 1.0 - flat;
                
                double tu = r * Math.sin(glat1) / Math.cos(glat1);
@@ -264,7 +266,7 @@ public enum GeodeticComputationStrategy {
                        x = e * cy;
                        y = e + e - 1.0;
                        y = (((sy * sy * 4.0 - 3.0) * y * cz * d / 6.0 + x) *
-                                                                       d / 4.0 - cz) * sy * d + tu;
+                                       d / 4.0 - cz) * sy * d + tu;
                } while (Math.abs(y - c) > PRECISION_LIMIT);
                
                baz = cu * cy * cf - su * sy;
@@ -285,5 +287,5 @@ public enum GeodeticComputationStrategy {
                return ret;
        }
        
-
+       
 }
index ab5c48ab7becc5d1c9f4b28cbc7b4134fb2f9a00..57f5d5203f444fe365ef6948703221aa6f10ac14 100644 (file)
@@ -14,12 +14,13 @@ 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;
 
 public class HttpURLConnectionMock extends HttpURLConnection {
-
+       
        private static final URL MOCK_URL;
        static {
                try {
@@ -88,7 +89,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        }
        
        
-
+       
        @Override
        public void connect() {
                if (!connected) {
@@ -99,17 +100,17 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        connected = true;
                }
        }
-
+       
        @Override
        public void disconnect() {
                
        }
-
+       
        @Override
        public boolean usingProxy() {
                return false;
        }
-
+       
        
        
        
@@ -117,69 +118,69 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public boolean getInstanceFollowRedirects() {
                return this.instanceFollowRedirects;
        }
-
+       
        @Override
        public void setInstanceFollowRedirects(boolean followRedirects) {
                assertFalse(connected);
                this.instanceFollowRedirects = followRedirects;
        }
-
+       
        @Override
        public String getRequestMethod() {
-               return this.requestMethod; 
+               return this.requestMethod;
        }
-
+       
        @Override
        public void setRequestMethod(String method) throws ProtocolException {
                assertFalse(connected);
                this.requestMethod = method;
        }
-
+       
        @Override
        public int getResponseCode() throws IOException {
                connect();
                return this.responseCode;
        }
-
+       
        public void setResponseCode(int code) {
                this.responseCode = code;
        }
        
-
+       
        @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));
        }
-
-
+       
+       
        @Override
        public int getConnectTimeout() {
                return this.connectTimeout;
        }
-
+       
        @Override
        public void setConnectTimeout(int timeout) {
                assertFalse(connected);
                this.connectTimeout = timeout;
        }
-
-
-
+       
+       
+       
        @Override
        public String getContentEncoding() {
                connect();
@@ -189,9 +190,9 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public void setContentEncoding(String encoding) {
                this.contentEncoding = encoding;
        }
-
-
-
+       
+       
+       
        @Override
        public int getContentLength() {
                connect();
@@ -199,7 +200,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        return 0;
                return content.length;
        }
-
+       
        public void setContent(byte[] content) {
                this.content = content;
        }
@@ -211,8 +212,8 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        fail("UTF-8");
                }
        }
-
-
+       
+       
        @Override
        public String getContentType() {
                connect();
@@ -222,35 +223,35 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public void setContentType(String type) {
                this.contentType = type;
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getDoInput() {
                return this.doInput;
        }
-
-
+       
+       
        @Override
        public void setDoInput(boolean doinput) {
                assertFalse(connected);
                this.doInput = doinput;
        }
-
-
+       
+       
        @Override
        public boolean getDoOutput() {
                return this.doOutput;
        }
-
-
+       
+       
        @Override
        public void setDoOutput(boolean dooutput) {
                assertFalse(connected);
                this.doOutput = dooutput;
        }
-
-
+       
+       
        @Override
        public InputStream getInputStream() throws IOException {
                assertTrue(doInput);
@@ -261,8 +262,8 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                inputStream = new ByteArrayInputStream(content);
                return inputStream;
        }
-
-
+       
+       
        @Override
        public OutputStream getOutputStream() throws IOException {
                assertTrue(doOutput);
@@ -283,29 +284,26 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        return null;
                }
        }
-
-
-
+       
+       
+       
        @Override
        public void setUseCaches(boolean usecaches) {
                assertFalse(connected);
                this.useCaches = usecaches;
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getUseCaches() {
                return this.useCaches;
        }
-
-
-
-
-
-
-
-
+       
+       
+       
+       
+       
        private void assertNull(Object o) {
                try {
                        org.junit.Assert.assertNull(o);
@@ -314,7 +312,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertNotNull(Object o) {
                try {
                        org.junit.Assert.assertNotNull(o);
@@ -323,7 +321,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertTrue(boolean o) {
                try {
                        org.junit.Assert.assertTrue(o);
@@ -332,7 +330,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertFalse(boolean o) {
                try {
                        org.junit.Assert.assertFalse(o);
@@ -341,209 +339,196 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void fail(String msg) {
                failed = true;
                org.junit.Assert.fail(msg);
        }
-
-
-
-       
-
-
-
-
-
        
        
        
        
-
-       
        
-
-
        @Override
        public InputStream getErrorStream() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderField(int n) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public long getHeaderFieldDate(String name, long Default) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderFieldKey(int n) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public Permission getPermission() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public String getResponseMessage() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setChunkedStreamingMode(int chunklen) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setFixedLengthStreamingMode(int contentLength) {
                throw new UnsupportedOperationException();
        }
-
-
-
-
-
+       
+       
+       
+       
+       
        @Override
        public boolean getAllowUserInteraction() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Object getContent() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @SuppressWarnings("unchecked")
        @Override
        public Object getContent(Class[] classes) throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getDate() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getDefaultUseCaches() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getExpiration() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderField(String name) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public int getHeaderFieldInt(String name, int Default) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Map<String, List<String>> getHeaderFields() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public long getIfModifiedSince() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getLastModified() {
                throw new UnsupportedOperationException();
        }
-
+       
        @Override
        public int getReadTimeout() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Map<String, List<String>> getRequestProperties() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public URL getURL() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setAllowUserInteraction(boolean allowuserinteraction) {
                throw new UnsupportedOperationException();
        }
-
+       
        @Override
        public void setDefaultUseCaches(boolean defaultusecaches) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public void setIfModifiedSince(long ifmodifiedsince) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public void setReadTimeout(int timeout) {
                throw new UnsupportedOperationException();
        }
-
-
-
-
-
+       
+       
+       
+       
+       
        @Override
        public String toString() {
                throw new UnsupportedOperationException();
        }
-
+