File tree 2 files changed +10
-9
lines changed
firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,9 @@ static Architecture getValue() {
139
139
public static String streamToString (InputStream is ) {
140
140
// Previous code was running into this: http://code.google.com/p/android/issues/detail?id=14562
141
141
// on Android 2.3.3. The below code below does not exhibit that problem.
142
- final java .util .Scanner s = new java .util .Scanner (is ).useDelimiter ("\\ A" );
143
- return s .hasNext () ? s .next () : "" ;
142
+ try (final java .util .Scanner s = new java .util .Scanner (is ).useDelimiter ("\\ A" )) {
143
+ return s .hasNext () ? s .next () : "" ;
144
+ }
144
145
}
145
146
146
147
public static String sha1 (String source ) {
Original file line number Diff line number Diff line change @@ -661,15 +661,15 @@ private InputStream getResourceAsStream(String resource) {
661
661
}
662
662
663
663
private static byte [] readResource (InputStream is ) throws IOException {
664
- ByteArrayOutputStream out = new ByteArrayOutputStream ();
665
- byte [] buffer = new byte [1024 ];
666
- int length ;
664
+ try ( ByteArrayOutputStream out = new ByteArrayOutputStream ()) {
665
+ byte [] buffer = new byte [1024 ];
666
+ int length ;
667
667
668
- while ((length = is .read (buffer )) != -1 ) {
669
- out .write (buffer , 0 , length );
668
+ while ((length = is .read (buffer )) != -1 ) {
669
+ out .write (buffer , 0 , length );
670
+ }
671
+ return out .toByteArray ();
670
672
}
671
-
672
- return out .toByteArray ();
673
673
}
674
674
675
675
private void finalizePreviousNativeSession (String previousSessionId ) {
You can’t perform that action at this time.
0 commit comments