From 5e8d7d42d87de4eebf4e4104dd76e6922d751627 Mon Sep 17 00:00:00 2001 From: Vitalii Parfonov Date: Fri, 20 May 2016 14:44:01 +0300 Subject: [PATCH] Closing prevous connection if redirect (#1314) CODENVY-538:Closing previous connection if redirect Signed-off-by: Vitaly Parfonov --- .../src/main/java/org/eclipse/che/commons/lang/IoUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/commons/che-core-commons-lang/src/main/java/org/eclipse/che/commons/lang/IoUtil.java b/core/commons/che-core-commons-lang/src/main/java/org/eclipse/che/commons/lang/IoUtil.java index bbfbbdc74e..a44f7a3957 100644 --- a/core/commons/che-core-commons-lang/src/main/java/org/eclipse/che/commons/lang/IoUtil.java +++ b/core/commons/che-core-commons-lang/src/main/java/org/eclipse/che/commons/lang/IoUtil.java @@ -278,7 +278,9 @@ public class IoUtil { if (redirect) { String newUrl = conn.getHeaderField("Location"); // open the new connection again - http = (HttpURLConnection)new URL(newUrl).openConnection(); + http.disconnect(); + conn = new URL(newUrl).openConnection(); + http = (HttpURLConnection)conn; http.setRequestMethod(HttpMethod.GET); } }