From 270109b02c6155b8bf09f1f6f71c54eb0933ab49 Mon Sep 17 00:00:00 2001 From: Alex Dean Date: Wed, 23 Jul 2014 18:46:34 +0100 Subject: [PATCH 1/2] Fixed Java referer-parser doesn't work on Hadoop (fixes #76) --- java-scala/CHANGELOG | 4 ++++ .../java/com/snowplowanalytics/refererparser/Parser.java | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/java-scala/CHANGELOG b/java-scala/CHANGELOG index 0db11cc1..f96a2e7e 100644 --- a/java-scala/CHANGELOG +++ b/java-scala/CHANGELOG @@ -1,3 +1,7 @@ +Version 0.2.2 (2014-07-23) +-------------------------- +Fixed Java referer-parser doesn't work on Hadoop (#76) + Version 0.2.1 (2014-07-16) -------------------------- Updated build process for local Maven publishing (#72) diff --git a/java-scala/src/main/java/com/snowplowanalytics/refererparser/Parser.java b/java-scala/src/main/java/com/snowplowanalytics/refererparser/Parser.java index 4ad504d2..5e9a37e5 100644 --- a/java-scala/src/main/java/com/snowplowanalytics/refererparser/Parser.java +++ b/java-scala/src/main/java/com/snowplowanalytics/refererparser/Parser.java @@ -117,7 +117,7 @@ public Referer parse(URI refererUri, String pageHost, List internalDomai } public Referer parse(URL refererUrl, String pageHost){ - if(refererUrl == null) { return null; } + if (refererUrl == null) { return null; } return parse(refererUrl.getProtocol(), refererUrl.getHost(), refererUrl.getPath(), refererUrl.getQuery(), pageHost); } @@ -202,9 +202,12 @@ private String extractSearchTerm(String query, List possibleParameters) List params; try { - params = URLEncodedUtils.parse(query, Charset.forName("UTF-8")); + params = URLEncodedUtils.parse(new URI("http://localhost?" + query), "UTF-8"); + // params = URLEncodedUtils.parse(query, Charset.forName("UTF-8")); because https://github.com/snowplow/referer-parser/issues/76 } catch (IllegalArgumentException iae) { return null; + } catch (URISyntaxException use) { // For new URI + return null; } for (NameValuePair pair : params) { From 59708956a7113a1fa30fc15c2f154c221873def1 Mon Sep 17 00:00:00 2001 From: Alex Dean Date: Wed, 23 Jul 2014 18:50:11 +0100 Subject: [PATCH 2/2] Bumped version to 0.2.2 --- java-scala/project/BuildSettings.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-scala/project/BuildSettings.scala b/java-scala/project/BuildSettings.scala index 65c5e63d..06833ccb 100644 --- a/java-scala/project/BuildSettings.scala +++ b/java-scala/project/BuildSettings.scala @@ -22,7 +22,7 @@ object BuildSettings { // Basic settings for our app lazy val basicSettings = Seq[Setting[_]]( organization := "com.snowplowanalytics", - version := "0.2.1", + version := "0.2.2", description := "Library for extracting marketing attribution data from referer URLs", scalaVersion := "2.9.1", crossScalaVersions := Seq("2.9.1", "2.10.4", "2.11.1"),