tomsik68 / mclauncher-api

Tomsik68's Minecraft Launcher API. Documenting how minecraft launcher works & creating an API which will be able to work with custom launchers. Make sure to check out wiki!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logout should not use doCheckedLoginPost

Safranil opened this issue · comments

Hello,

YDLoginService#logout shouldn't use YDLoginService#doCheckedLoginPost to do a disconnection because the Mojang API seem to return nothing, after a debug, an exception is thrown at line 64 (tag v0.3.1).

The JSONObject jsonObject = (JSONObject)JSONValue.parse(jsonString); statement parse an empty string and return a String object.

Here is the stacktrace :

java.lang.ClassCastException: java.lang.String cannot be cast to net.minidev.json.JSONObject
    at sk.tomsik68.mclauncher.impl.login.yggdrasil.YDLoginService.doCheckedLoginPost(YDLoginService.java:64)
    at sk.tomsik68.mclauncher.impl.login.yggdrasil.YDLoginService.logout(YDLoginService.java:137)
    at safranil.minecraft.miroa.MiroaLauncher.logout(MiroaLauncher.java:116)
    at safranil.minecraft.miroa.OptionController.logoutAction(OptionController.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at [...]
    at java.lang.Thread.run(Thread.java:745)

Can you correct this ?

Regards

Thanks for reporting the issue. I've introduced doLoginPost which doesn't check the return type and is used by the logout method. If it doesn't work as desired, just reopen the issue.

It's ok for me. You do a very good work 😃.

Thank you.