Skip to content

Commit 7009c35

Browse files
committed
formatting try catches
1 parent b552ced commit 7009c35

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/BytesBackedNativeSessionFile.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ private boolean isEmpty() {
6767

6868
@Nullable
6969
private byte[] asGzippedBytes() {
70-
try {
71-
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
72-
final GZIPOutputStream gos = new GZIPOutputStream(bos);
70+
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
71+
GZIPOutputStream gos = new GZIPOutputStream(bos)) {
7372
gos.write(bytes);
7473
gos.finish();
7574
return bos.toByteArray();

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/FileBackedNativeSessionFile.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ public CrashlyticsReport.FilesPayload.File asFilePayload() {
7575
@Nullable
7676
private byte[] asBytes() {
7777
final byte[] readBuffer = new byte[8192];
78-
try (InputStream stream = getStream()) {
78+
try (InputStream stream = getStream();
79+
ByteArrayOutputStream bos = new ByteArrayOutputStream();
80+
GZIPOutputStream gos = new GZIPOutputStream(bos)) {
7981
if (stream == null) {
8082
return null;
8183
}
82-
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
83-
final GZIPOutputStream gos = new GZIPOutputStream(bos);
8484
int read;
8585
while ((read = stream.read(readBuffer)) > 0) {
8686
gos.write(readBuffer, 0, read);

0 commit comments

Comments
 (0)