# HG changeset patch # User Omair Majid # Date 1400708211 14400 # Node ID f4f4d882e71fb61f56476ee8f2faadeca451d2c2 # Parent 6c613257d90cece5830ebcb6c5d263366c846163 Fix integration tests on OpenJDK 8 Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-May/009802.html PR1790 diff -r 6c613257d90c -r f4f4d882e71f web/client/src/main/java/com/redhat/thermostat/web/client/internal/WebStorage.java --- a/web/client/src/main/java/com/redhat/thermostat/web/client/internal/WebStorage.java Wed May 21 17:23:49 2014 -0400 +++ b/web/client/src/main/java/com/redhat/thermostat/web/client/internal/WebStorage.java Wed May 21 17:36:51 2014 -0400 @@ -55,7 +55,6 @@ import java.util.logging.Logger; import javax.net.ssl.SSLContext; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.binary.Base64; import org.apache.http.Header; @@ -111,6 +110,9 @@ public class WebStorage implements Storage, SecureStorage { + private static final int STATUS_OK = 200; + private static final int STATUS_NO_CONTENT = 204; + private static final String HTTPS_PREFIX = "https"; static final Logger logger = LoggingUtils.getLogger(WebStorage.class); @@ -422,11 +424,11 @@ StatusLine status = response.getStatusLine(); int responseCode = status.getStatusCode(); switch (responseCode) { - case (HttpServletResponse.SC_NO_CONTENT): - // Let calling code handle SC_NO_CONTENT + case (STATUS_NO_CONTENT): + // Let calling code handle STATUS_NO_CONTENT break; - case (HttpServletResponse.SC_OK): - // Let calling code handle SC_OK + case (STATUS_OK): + // Let calling code handle STATUS_OK break; default: // Properly consume the entity, thus closing the content stream, @@ -558,7 +560,7 @@ NameValuePair fileParam = new BasicNameValuePair("file", name); List formparams = Arrays.asList(fileParam); CloseableHttpEntity entity = post(endpoint + "/load-file", formparams); - if (entity.getResponseCode() == HttpServletResponse.SC_NO_CONTENT) { + if (entity.getResponseCode() == STATUS_NO_CONTENT) { return null; } return new WebDataStream(entity); @@ -622,7 +624,7 @@ httpPost.setEntity(entity); response = httpClient.execute(httpPost); StatusLine status = response.getStatusLine(); - return status.getStatusCode() == 200; + return status.getStatusCode() == STATUS_OK; } catch (IOException ex) { throw new StorageException(ex); } finally {