Mercurial > hg > release > thermostat-1.0
changeset 1403:f4f4d882e71f
Fix integration tests on OpenJDK 8
Reviewed-by: jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-May/009802.html
PR1790
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Wed, 21 May 2014 17:36:51 -0400 |
parents | 6c613257d90c |
children | 72ad85995de7 |
files | web/client/src/main/java/com/redhat/thermostat/web/client/internal/WebStorage.java |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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<NameValuePair> 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 {