Skip to content

Commit

Permalink
fixed slash character problem if it is entered last char of connectio…
Browse files Browse the repository at this point in the history
…n string
  • Loading branch information
ferhatsb committed Sep 24, 2012
1 parent 651b1ce commit 8d3cdca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/io/searchbox/client/AbstractJestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ public void setServers(LinkedHashSet<String> servers) {
}

public <T> T executeAsync(Action clientRequest) {
return null; //To change body of implemented methods use File | Settings | File Templates.
return null;
}

public void shutdownClient() {
//To change body of implemented methods use File | Settings | File Templates.
}

protected String getElasticSearchServer() {
Expand Down Expand Up @@ -101,13 +100,15 @@ protected Map convertJsonStringToMapObject(String jsonTxt) {
}

protected String getRequestURL(String elasticSearchServer, String uri) {
StringBuilder sb = new StringBuilder(elasticSearchServer);
String serverUrl = elasticSearchServer.endsWith("/") ?
elasticSearchServer.substring(0, elasticSearchServer.length() - 1) : elasticSearchServer;

StringBuilder sb = new StringBuilder(serverUrl);
String modifiedURI = modifyData(uri);

if (useDefaults) {
if (StringUtils.isNotBlank(defaultIndex)) {
if (!elasticSearchServer.endsWith("/")) sb.append("/");
sb.append(defaultIndex);
sb.append("/").append(defaultIndex);
}
if (StringUtils.isNotBlank(defaultType)) {
sb.append("/").append(defaultType);
Expand Down

0 comments on commit 8d3cdca

Please sign in to comment.