SumoLogic/sumo-java-client — pull request #17 by joseamuniz (2013-04-14 01:02:34+00:00)
Title:  SUMO-15772 Sumo client should correctly provide HTTP Source endpoint

Also, show a nicer error message when service is unavailable or when the service responds with a non-JSON error message.

Before:

```
com.sumologic.client.SumoClientException: Runtime error reading server response
at com.sumologic.client.util.HttpUtils.doRequest(HttpUtils.java:225)
at com.sumologic.client.util.HttpUtils.doRequest(HttpUtils.java:173)
at com.sumologic.client.util.HttpUtils.post(HttpUtils.java:79)
at com.sumologic.client.collectors.CollectorsClient.create(CollectorsClient.java:37)
at com.sumologic.client.SumoLogicClient.createCollector(SumoLogicClient.java:236)
at com.sumologic.SourceCreate.main(SourceCreate.java:31)
... 6 more
Caused by: com.sumologic.client.SumoClientException: Exception while parsing JSON:

at com.sumologic.client.SumoServerException.(SumoServerException.java:47)
at com.sumologic.client.util.HttpUtils.doRequest(HttpUtils.java:211)
... 11 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
at [Source: java.io.StringReader@6b4d6015; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:163)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:2623)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2565)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1817)
at com.sumologic.client.SumoServerException.(SumoServerException.java:38)
... 12 more
```

Now:

```
com.sumologic.client.SumoServerException: The server responded with HTTP Status: 503
at com.sumologic.client.util.HttpUtils.doRequest(HttpUtils.java:215)
at com.sumologic.client.util.HttpUtils.doRequest(HttpUtils.java:173)
at com.sumologic.client.util.HttpUtils.post(HttpUtils.java:79)
at com.sumologic.client.collectors.CollectorsClient.create(CollectorsClient.java:37)
at com.sumologic.client.SumoLogicClient.createCollector(SumoLogicClient.java:236)
at com.sumologic.SourceCreate.main(SourceCreate.java:31)
... 6 more

```