prepareConnection: avoid double slashes when constructing connection URL
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 18 Mar 2019 09:14:25 +0000 (11:14 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 25 Mar 2019 06:17:36 +0000 (06:17 +0000)
app/src/main/java/net/ktnx/mobileledger/utils/NetworkUtil.java

index 821a712..12758b1 100644 (file)
@@ -31,10 +31,10 @@ public final class NetworkUtil {
     private static final int thirtySeconds = 30000;
     public static HttpURLConnection prepareConnection(MobileLedgerProfile profile, String path)
             throws IOException {
-        final String url = profile.getUrl();
+        String url = profile.getUrl();
         final boolean use_auth = profile.isAuthEnabled();
-        if (!url.endsWith("/")) url.concat("/");
-        url.concat(path);
+        if (!url.endsWith("/")) url += "/";
+        url += path;
         Log.d("network", "Connecting to " + url);
         HttpURLConnection http = (HttpURLConnection) new URL(url).openConnection();
         if (use_auth) {