Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change base64 format with no_wrap #12

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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