Documentation is not sufficiently cross-linked:
For example: http://stellar.github.io/java-stellar-sdk/org/stellar/sdk/effects/AccountCreditedEffect.html doesn't contain a link to the method which creates it. Such a link would be helpful for a newb trying to program against the API without any examples to work from.
Calling an accounts request gives an uninformative error message:
final Server stellarServer = new Server ("http://localhost:8080/"); final AccountsRequestBuilder accountsRequest = stellarServer.accounts(); try { final Page<Account> accounts = accountsRequest.execute(); } catch (IOException accountsRequestExecuteException) { System.out.println("Requesting accounts failed: " + accountsRequestExecuteException); }
Results in this error message:
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Not a JSON Object: "<b>Welcome" at com.google.gson.Gson.fromJson(Gson.java:826) at com.google.gson.Gson.fromJson(Gson.java:779) at com.google.gson.Gson.fromJson(Gson.java:728) at org.stellar.sdk.requests.ResponseHandler.handleResponse(ResponseHandler.java:45) at org.apache.http.client.fluent.Response.handleResponse(Response.java:90) at org.stellar.sdk.requests.AccountsRequestBuilder.execute(AccountsRequestBuilder.java:35) at org.stellar.sdk.requests.AccountsRequestBuilder.execute(AccountsRequestBuilder.java:39) at org.mifos.connector.stellar.SendTransaction.main(SendTransaction.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: java.lang.IllegalStateException: Not a JSON Object: "<b>Welcome" at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90) at org.stellar.sdk.PageDeserializer.deserialize(PageDeserializer.java:37) at org.stellar.sdk.PageDeserializer.deserialize(PageDeserializer.java:19) at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) at com.google.gson.Gson.fromJson(Gson.java:814) ... 12 more Process finished with exit code 1
May occur because I don't have Horizon installed on local host.