File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,9 @@ static Architecture getValue() {
139139 public static String streamToString (InputStream is ) {
140140 // Previous code was running into this: http://code.google.com/p/android/issues/detail?id=14562
141141 // 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+ }
144145 }
145146
146147 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) {
661661 }
662662
663663 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 ;
667667
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 ();
670672 }
671-
672- return out .toByteArray ();
673673 }
674674
675675 private void finalizePreviousNativeSession (String previousSessionId ) {
You can’t perform that action at this time.
0 commit comments