diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-08-28 09:03:46 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-08-28 09:03:46 +0200 |
commit | f63df3e9a3d8a2de817480b98ebb25acaaba196c (patch) | |
tree | 453eb7461a65e4b48e6d2398c04bdad878d60441 /container-accesslogging | |
parent | 64128383875b1b3a4e0bbf44a90a29fe2ea33cff (diff) |
Avoid using deprecated code and enable it as error.
Diffstat (limited to 'container-accesslogging')
5 files changed, 8 insertions, 9 deletions
diff --git a/container-accesslogging/pom.xml b/container-accesslogging/pom.xml index b6f714ca115..0d7b134c58c 100644 --- a/container-accesslogging/pom.xml +++ b/container-accesslogging/pom.xml @@ -94,7 +94,6 @@ <compilerArgs> <arg>-Xlint:all</arg> <arg>-Xlint:-serial</arg> - <arg>-Xlint:-deprecation</arg> <arg>-Werror</arg> </compilerArgs> </configuration> diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogSampler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogSampler.java index 3060a296884..12d29c2f333 100644 --- a/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogSampler.java +++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogSampler.java @@ -24,7 +24,7 @@ public class AccessLogSampler implements AccessLogInterface { if (accessLogEntry.getStatusCode() != 200) { return; } - String uriString = accessLogEntry.getURI().toString(); + String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/YApacheFormatter.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/YApacheFormatter.java index b3a3c0ffc05..f63d02b1a77 100644 --- a/container-accesslogging/src/main/java/com/yahoo/container/logging/YApacheFormatter.java +++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/YApacheFormatter.java @@ -38,7 +38,7 @@ public class YApacheFormatter { setStatusCode(accessLogEntry.getStatusCode()); setRemoteAddress(accessLogEntry.getRemoteAddress()); setRemotePort(accessLogEntry.getRemotePort()); - setURI(accessLogEntry.getURI()); + setURI(URI.create(accessLogEntry.getRawPath())); setCookie(accessLogEntry.getCookieType(), accessLogEntry.getCookie()); setWeekOfRegistration(accessLogEntry.getWeekOfRegistration()); setProfile(accessLogEntry.getProfile()); diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/AccessLogSamplerTest.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/AccessLogSamplerTest.java index 50a98b3d949..35664049560 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/AccessLogSamplerTest.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/AccessLogSamplerTest.java @@ -57,7 +57,7 @@ public class AccessLogSamplerTest { private AccessLogEntry createLogEntry(int statusCode, String uri) { AccessLogEntry accessLogEntry = new AccessLogEntry(); accessLogEntry.setStatusCode(statusCode); - accessLogEntry.setURI(URI.create(uri)); + accessLogEntry.setRawPath(uri); return accessLogEntry; } } diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java index 03a0f85311e..a643ba77703 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java @@ -82,7 +82,7 @@ public class YApacheLogTestCase { entry.setTimeStamp(920880005L*1000); entry.setDurationBetweenRequestResponse(122); entry.setReturnedContentSize(9875); - entry.setURI(new URI("/Business/Companies/Financial_Services/Investment_Services/Mutual_Funds/")); + entry.setRawPath("/Business/Companies/Financial_Services/Investment_Services/Mutual_Funds/"); entry.setRemotePort(12345); } @@ -165,7 +165,7 @@ public class YApacheLogTestCase { public void testThatQueryWithEncodedCharactersIsLoggedInEncodedForm() { final String query = "%5E%3B%22"; final AccessLogEntry entry = new AccessLogEntry(); - entry.setURI(newQueryUri(query)); + entry.setRawPath(newQueryPath(query)); assertThat(new YApacheFormatter(entry).format(), containsString(query)); } @@ -174,7 +174,7 @@ public class YApacheLogTestCase { entry.setIpV4Address("0.0.0.0"); entry.setUser("user"); entry.setHttpMethod("GET"); - entry.setURI(newQueryUri(query)); + entry.setRawPath(newQueryPath(query)); entry.setHttpVersion("HTTP/1.1"); entry.setReferer(EMPTY_REFERRER); entry.setUserAgent(EMPTY_USERAGENT); @@ -303,8 +303,8 @@ public class YApacheLogTestCase { } } - private static URI newQueryUri(final String query) { - return URI.create("http://localhost?query=" + query); + private static String newQueryPath(final String query) { + return "http://localhost?query=" + query; } } |