Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.14.4/1.15.2] Userdev Login provides incorrect userProperties launch argument #6563

Closed
Choonster opened this issue Mar 13, 2020 · 0 comments

Comments

@Choonster
Copy link
Contributor

Choonster commented Mar 13, 2020

Originally reported here for 1.14.4, another user reported it for 1.15.2 a few hours ago. The problem code appears to be in both versions.

Running the client in userdev with the --username and --password argument produces this error:

 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException	
 	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39)	
 	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
 	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68)	
 	at cpw.mods.modlauncher.Launcher.run(Launcher.java:80)	
 	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)	
 	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)	
 Caused by: java.lang.reflect.InvocationTargetException	
 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	
 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	
 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	
 	at java.lang.reflect.Method.invoke(Unknown Source)	
 	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)	
 	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)	
 	... 5 more	
 Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 3 path $.	
 	at com.google.gson.internal.Streams.parse(Streams.java:60)	
 	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65)	
 	at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:357)	
 	at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:382)	
 	at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:403)	
 	at net.minecraft.client.main.Main.main(Main.java:101)	
 	... 11 more	
 Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 3 path $.	
 	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559)	
 	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401)	
 	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:508)	
 	at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414)	
 	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:738)	
 	at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714)	
 	at com.google.gson.internal.Streams.parse(Streams.java:48)	
 	... 16 more

It looks like this is an error in Forge's dev-time login implementation, specifically this line:

args.put("userProperties", auth.getUserProperties().toString());

As can be seen on line 12 of the OP's Gradle scan, this creates a string like {preferredLanguage=[com.mojang.authlib.properties.Property@d5b810e]} for the userProperties argument.

Minecraft's Main class attempts to deserialise the userProperties argument as JSON and throws the above error because this string isn't valid JSON.

Instead of using toString, LaunchTesting probably needs to use PropertyMap.Serializer (via Gson) to properly serialise the user properties as JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants