I'm using the StackWrap4J java wrapper for the Stack Overflow API.
But every code I try, that uses methods of this java wrapper, ends with this JSONException:
net.sf.stackwrap4j.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at net.sf.stackwrap4j.json.JSONTokener.syntaxError(JSONTokener.java:423)
at net.sf.stackwrap4j.json.JSONObject.(JSONObject.java:183)
at net.sf.stackwrap4j.json.JSONObject.(JSONObject.java:310)
at net.sf.stackwrap4j.StackWrapper.getUserById(StackWrapper.java:716)
at stackoverflowmain.main(stackoverflowmain.java:26)
Exception in thread "main" java.lang.NullPointerException
at stackoverflowmain.main(stackoverflowmain.java:32)
This is the current code that resulted with the above exception (but it's same for any method from the this wrapper that I have tried) :
StackOverflow stack = new StackOverflow();
User user = null;
try {
user = stack.getUserById(4629408);
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
int rep = user.getReputation();
System.out.print(rep);