MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
299 stars 288 forks source link

0.49.12 password in dedicated server crashes MegaMek #4274

Open seem8 opened 1 year ago

seem8 commented 1 year ago

Environment

Linux: RHEL 9 Java: OpenJDK, both on versions 11 and 17 MegaMek 0.49.12 (0.48.0 is not affected)

Description

Running MegaMek dedicated server with a password crashes it: java -jar MegaMek.jar -dedicated -port 2468 -p passwoRD1234

Files

magemek.log

14:12:41,634 INFO  [megamek.MegaMek] {main}
megamek.MegaMek.initializeLogging(MegaMek.java:115) - Starting MegaMek v0.49.12
    Build Date: 2023-03-04T15:21:51.779081200
    Today: 2023-03-26
    Origin Project: MegaMek
    Java Vendor: Eclipse Adoptium
    Java Version: 17.0.5
    Platform: Linux 5.14.0-162.18.1.el9_1.x86_64 (amd64)
    System Locale: pl_PL
    Total memory available to MegaMek: 4 GB

14:12:41,636 INFO  [megamek.MegaMek] {main}
megamek.MegaMek.handleLegacyLogging(MegaMek.java:128) - Redirecting System.out, System.err, and Throwable::printStackTrace output to legacy.log

14:12:41,664 ERROR [megamek.client.ui.Messages] {main}
megamek.client.ui.Messages.getString(Messages.java:41) - Missing i18n entry: MegaMek.Help.EquipmentExtendedDB

14:12:41,664 ERROR [megamek.client.ui.Messages] {main}
megamek.client.ui.Messages.getString(Messages.java:41) - Missing i18n entry: MegaMek.Help.UnitExport

14:12:41,664 ERROR [megamek.client.ui.Messages] {main}
megamek.client.ui.Messages.getString(Messages.java:41) - Missing i18n entry: MegaMek.Help.UnitValidator

14:12:41,664 ERROR [megamek.client.ui.Messages] {main}
megamek.client.ui.Messages.getString(Messages.java:41) - Missing i18n entry: MegaMek.Help.OfficialUnitList

14:12:41,664 ERROR [megamek.client.ui.Messages] {main}
megamek.client.ui.Messages.getString(Messages.java:41) - Missing i18n entry: MegaMek.Help.UnitAlphastrikeConversion

14:12:41,665 INFO  [megamek.MegaMek] {main}
megamek.MegaMek.startDedicatedServer(MegaMek.java:224) - Starting Dedicated Server. [-port, 2468, -p, passwoRD1234]

14:12:41,668 ERROR [megamek.common.commandline.ClientServerCommandLineFlag] {main}
megamek.common.commandline.ClientServerCommandLineFlag.parseFromString(ClientServerCommandLineFlag.java:62) - Failed to parse the ClientServerCommandLineFlag from 'p'

14:12:41,668 ERROR [megamek.MegaMek] {main}
megamek.MegaMek.lambda$main$0(MegaMek.java:61) - Uncaught Exception Detected
java.lang.IllegalArgumentException: No enum constant megamek.common.commandline.ClientServerCommandLineFlag.P
    at java.base/java.lang.Enum.valueOf(Enum.java:273)
    at megamek.common.commandline.ClientServerCommandLineFlag.valueOf(ClientServerCommandLineFlag.java:23)
    at megamek.common.commandline.ClientServerCommandLineFlag.parseFromString(ClientServerCommandLineFlag.java:60)
    at megamek.common.commandline.ClientServerCommandLineParser.start(ClientServerCommandLineParser.java:119)
    at megamek.common.commandline.AbstractCommandLineParser.parse(AbstractCommandLineParser.java:102)
    at megamek.server.DedicatedServer.start(DedicatedServer.java:34)
    at megamek.MegaMek.startDedicatedServer(MegaMek.java:225)
    at megamek.MegaMek.main(MegaMek.java:80)

Maybe I am doing something wrong, but it works on versions 0.48.0 and 0.46.0.

SJuliez commented 1 year ago

Not from experience, but from reading the code I think you have to type out -password, so -dedicated -port 2468 -password passwoRD1234