diff --git a/blueocean-rest-impl/pom.xml b/blueocean-rest-impl/pom.xml
index e0eca13c76b..79599bf2b51 100644
--- a/blueocean-rest-impl/pom.xml
+++ b/blueocean-rest-impl/pom.xml
@@ -90,17 +90,6 @@
keen-client-api-java
-
- com.github.ua-parser
- uap-java
-
-
- org.yaml
- snakeyaml
-
-
-
-
org.jenkins-ci.main
jenkins-test-harness-tools
diff --git a/blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsProperties.java b/blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsProperties.java
deleted file mode 100644
index c0c3cc5967b..00000000000
--- a/blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsProperties.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package io.jenkins.blueocean.service.embedded.analytics;
-
-import hudson.Extension;
-import io.jenkins.blueocean.analytics.AdditionalAnalyticsProperties;
-import io.jenkins.blueocean.analytics.Analytics.TrackRequest;
-import org.kohsuke.stapler.Stapler;
-import org.kohsuke.stapler.StaplerRequest;
-import ua_parser.Client;
-import ua_parser.Parser;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.apache.commons.lang.StringUtils.isNotEmpty;
-
-@Extension
-public class BrowserAndOperatingSystemAnalyticsProperties extends AdditionalAnalyticsProperties {
-
- private static final Parser PARSER = new Parser();
-
- @Override
- public Map properties(TrackRequest req) {
- StaplerRequest httpReq = Stapler.getCurrentRequest();
- if (httpReq == null) {
- return null;
- }
- String userAgent = httpReq.getHeader("User-Agent");
- if (userAgent == null) {
- return null;
- }
- Client client = PARSER.parse(userAgent);
- String browserFamily = client.userAgent.family;
- // If we can't find the browser family then we shouldn't record anything
- if (browserFamily == null) {
- return null;
- }
- Map props = new HashMap<>();
- props.put("browserFamily", browserFamily);
- String browserVersionMajor = client.userAgent.major;
- // Versions are useful if they are available
- if (isNotEmpty(browserVersionMajor)) {
- props.put("browserVersionMajor", browserVersionMajor);
- }
- String browserVersionMinor = client.userAgent.minor;
- if (isNotEmpty(browserVersionMinor)) {
- props.put("browserVersionMinor", browserVersionMinor);
- }
- // If the operating system is available lets use that
- String operatingSystemFamily = client.os.family;
- if (isNotEmpty(operatingSystemFamily)) {
- props.put("osFamily", operatingSystemFamily);
- String osVersionMajor = client.os.major;
- if (isNotEmpty(osVersionMajor)) {
- props.put("osVersionMajor", osVersionMajor);
- }
- String osVersionMinor = client.os.minor;
- if (isNotEmpty(osVersionMinor)) {
- props.put("osVersionMinor", osVersionMinor);
- }
- }
- return props;
- }
-}
diff --git a/blueocean-rest-impl/src/test/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsPropertiesTest.java b/blueocean-rest-impl/src/test/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsPropertiesTest.java
deleted file mode 100644
index 2c6e166f904..00000000000
--- a/blueocean-rest-impl/src/test/java/io/jenkins/blueocean/service/embedded/analytics/BrowserAndOperatingSystemAnalyticsPropertiesTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package io.jenkins.blueocean.service.embedded.analytics;
-
-import io.jenkins.blueocean.analytics.Analytics;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Test;
-import org.kohsuke.stapler.Stapler;
-import org.kohsuke.stapler.StaplerRequest;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-public class BrowserAndOperatingSystemAnalyticsPropertiesTest {
-
- private MockedStatic staplerMockedStatic;
-
- @Test
- public void parsesUserAgentAndCreatesPropertiesForChrome() throws Exception {
- BrowserAndOperatingSystemAnalyticsProperties props = setup("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36");
- Map actual = new HashMap<>(props.properties(new Analytics.TrackRequest("bob", null)));
- Assert.assertEquals(6, actual.size());
- Assert.assertEquals("41", actual.get("browserVersionMajor"));
- Assert.assertEquals("10", actual.get("osVersionMinor"));
- Assert.assertEquals("Mac OS X", actual.get("osFamily"));
- Assert.assertEquals("Chrome", actual.get("browserFamily"));
- Assert.assertEquals("0", actual.get("browserVersionMinor"));
- Assert.assertEquals("10", actual.get("osVersionMajor"));
- }
-
- @Test
- public void parsesUserAgentAndCreatesPropertiesForSafari() throws Exception {
- BrowserAndOperatingSystemAnalyticsProperties props = setup("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A");
- Map actual = new HashMap<>(props.properties(new Analytics.TrackRequest("bob", null)));
-
- Assert.assertEquals(6, actual.size());
- Assert.assertEquals("7", actual.get("browserVersionMajor"));
- Assert.assertEquals("9", actual.get("osVersionMinor"));
- Assert.assertEquals("Mac OS X", actual.get("osFamily"));
- Assert.assertEquals("Safari", actual.get("browserFamily"));
- Assert.assertEquals("0", actual.get("browserVersionMinor"));
- Assert.assertEquals("10", actual.get("osVersionMajor"));
- }
-
- private BrowserAndOperatingSystemAnalyticsProperties setup(String userAgent) {
- StaplerRequest request = Mockito.mock(StaplerRequest.class);
- Mockito.when(request.getHeader("User-Agent")).thenReturn(userAgent);
- staplerMockedStatic = Mockito.mockStatic(Stapler.class);
- Mockito.when(Stapler.getCurrentRequest()).thenReturn(request);
- return new BrowserAndOperatingSystemAnalyticsProperties();
- }
-
- @After
- public void cleanup() {
- if (staplerMockedStatic!=null) {
- staplerMockedStatic.close();
- }
- }
-}
diff --git a/pom.xml b/pom.xml
index b8f4ef896bd..7297de078f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -237,6 +237,12 @@
pom
+
+ org.jenkins-ci
+ symbol-annotation
+ 1.23
+
+
${project.groupId}
@@ -503,19 +509,6 @@
-
- com.github.ua-parser
- uap-java
- 1.5.2
-
-
-
- commons-collections
- commons-collections
-
-
-
-
org.jenkins-ci.plugins