Closed nea89o closed 2 years ago
Apologies for my late reply. Can you please share the full stacktrace?
I also get an NPE on Mojang#connect()
i think that's the HashMap initialization ?
@SparklingComet your Mojang#connect()
method expects a Jsonobject (via getJSONObject
which returns null
if the api returns an array) the following obj.forEach
causes the NullPointerException
. i currently dont have a stacktrace ready, but any call to Mojang#connect did this (accross various PCs)
@Iddenn submitted a fix, please let me know whether the issue has been solved.
import org.shanerx.mojang.Mojang;
public class Main {
public static void main(String[] args) {
Mojang mojang = new Mojang();
mojang.connect();
}
}
yields the following error
Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject
at org.shanerx.mojang.Mojang.getJSONObject(Mojang.java:329)
at org.shanerx.mojang.Mojang.connect(Mojang.java:59)
which caused be the exact same problem as before: mojang.connect()
expects https://status.mojang.com/check to return a JSONObject, but it returns a JSONArray
Should be fixed, please report back if you can.
Inactive issue, not relevant either way after #12 .
Upon trying to connect via
Mojang#connect()
I get a NullPointerException. I tracked this down toMojang#connect()
expecting https://status.mojang.com/check to return a Json OBJECT while it gives an array with the rough format