Skip to content

Commit

Permalink
feat: change base64 format with no_wrap (#12)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: xiaoweii <[email protected]>
  • Loading branch information
zhu-xiaowei and xiaoweii authored May 18, 2023
1 parent fa5c52c commit 923502d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private void checkAppVersionUpdate() {
this.clickstreamContext.getAnalyticsClient().createEvent(Event.PresetEvent.APP_UPDATE);
event.addAttribute(Event.ReservedAttribute.PREVIOUS_APP_VERSION, previousAppVersion);
this.clickstreamContext.getAnalyticsClient().recordEvent(event);
clickstreamContext.getSystem().getPreferences().putString("appVersion", currentVersion);
}
} else {
clickstreamContext.getSystem().getPreferences()
Expand All @@ -139,6 +140,7 @@ private void checkOSVersionUpdate() {
this.clickstreamContext.getAnalyticsClient().createEvent(Event.PresetEvent.OS_UPDATE);
event.addAttribute(Event.ReservedAttribute.PREVIOUS_OS_VERSION, previousOSVersion);
this.clickstreamContext.getAnalyticsClient().recordEvent(event);
clickstreamContext.getSystem().getPreferences().putString("osVersion", currentOSVersion);
}
} else {
clickstreamContext.getSystem().getPreferences()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static String compressForGzip(String ungzipStr) {
LOG.error("IOException occur when compressForGzip.");
}
if (encode != null) {
return Base64.encodeToString(encode, Base64.DEFAULT);
return Base64.encodeToString(encode, Base64.NO_WRAP);
} else {
LOG.error("compressForGzip fail.");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,19 @@ public void clipStringForAppendEllipses() {
assertTrue(StringUtil.clipString("abcdefgh", 5, true).endsWith("..."));
assertFalse(StringUtil.clipString("abcdefgh", 10, true).endsWith("..."));
}

/**
* test validate gzip with no wrap.
*/
@Test
public void validateGzipWithNoWrap() {
String str = "abcdeabcde";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 100; i++) {
sb.append(str);
}
String gzippedStr = StringUtil.compressForGzip(sb.toString());
assert gzippedStr != null;
assertFalse(gzippedStr.contains("\n"));
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx4g
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

VERSION_NAME=0.4.0
VERSION_NAME=0.4.1

POM_GROUP=software.aws.solution
POM_ARTIFACT_ID=clickstream
Expand Down

0 comments on commit 923502d

Please sign in to comment.