-
Notifications
You must be signed in to change notification settings - Fork 626
Fix the way of gzipping and base64. This is now consistent with server #3414
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
Conversation
Size Report 1Affected Products
Test Logs
Notes |
Coverage Report 1Affected Products
Test Logs
Notes |
firebase-common/src/main/java/com/google/firebase/heartbeatinfo/DefaultHeartBeatController.java
Outdated
Show resolved
Hide resolved
...e-common/src/test/java/com/google/firebase/heartbeatinfo/DefaultHeartBeatControllerTest.java
Show resolved
Hide resolved
firebase-common/src/main/java/com/google/firebase/heartbeatinfo/DefaultHeartBeatController.java
Outdated
Show resolved
Hide resolved
firebase-common/src/main/java/com/google/firebase/heartbeatinfo/DefaultHeartBeatController.java
Outdated
Show resolved
Hide resolved
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); | ||
try { | ||
try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteOutputStream)) { | ||
gzipOutputStream.write(input.getBytes(UTF_8)); | ||
} | ||
byte[] gzipped = byteOutputStream.toByteArray(); | ||
byteOutputStream.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you can use try with resources here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it complains saying byte[] is not a proper type for try with resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK not closing it is OK.
https://docs.oracle.com/javase/7/docs/api/java/io/ByteArrayOutputStream.html#close()
Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.
#3414) * push test pr * fix platform logging header request * small fixes * use try * fix tests * use strings * update * gJF
Fix the way of gzipping and base64. This is now consistent with server. Tests added to the server side as well.