File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
firebase-config/src/main/java/com/google/firebase/remoteconfig/internal Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -93,13 +93,10 @@ public synchronized Void write(ConfigContainer container) throws IOException {
93
93
*/
94
94
@ Nullable
95
95
public synchronized ConfigContainer read () throws IOException {
96
+
97
+ FileInputStream fileInputStream = null ;
96
98
try {
97
- context .openFileInput (fileName );
98
- } catch (FileNotFoundException e ) {
99
- return null ;
100
- }
101
- FileInputStream fileInputStream = context .openFileInput (fileName );
102
- try {
99
+ fileInputStream = context .openFileInput (fileName );
103
100
byte [] bytes = new byte [fileInputStream .available ()];
104
101
fileInputStream .read (bytes , 0 , bytes .length );
105
102
String containerJsonString = new String (bytes , JSON_STRING_ENCODING );
@@ -110,7 +107,7 @@ public synchronized ConfigContainer read() throws IOException {
110
107
// File might not have been written to yet, so this not an irrecoverable error.
111
108
return null ;
112
109
} finally {
113
- fileInputStream .close ();
110
+ if ( fileInputStream != null ) fileInputStream .close ();
114
111
}
115
112
}
116
113
You can’t perform that action at this time.
0 commit comments