Skip to content

Commit 4b52abf

Browse files
Merge branch 'feature'
# Conflicts: # app/build.properties
2 parents 5a42919 + 1dd2ef7 commit 4b52abf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build Properties
2-
#Sat Nov 10 11:20:14 EST 2018
2+
#Sat Nov 10 12:07:43 EST 2018
33
version_minor=0
44
version_build=14
55
version_patch=1

app/src/main/java/com/vrem/util/FileUtils.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ private FileUtils() {
3333

3434
@NonNull
3535
public static String readFile(@NonNull Resources resources, @RawRes int id) {
36-
try (InputStream inputStream = resources.openRawResource(id)) {
36+
InputStream inputStream = null;
37+
try {
38+
inputStream = resources.openRawResource(id);
3739
int size = inputStream.available();
3840
byte[] bytes = new byte[size];
3941
int count = inputStream.read(bytes);
@@ -44,7 +46,14 @@ public static String readFile(@NonNull Resources resources, @RawRes int id) {
4446
} catch (Exception e) {
4547
// file is corrupted
4648
return StringUtils.EMPTY;
49+
} finally {
50+
if (inputStream != null) {
51+
try {
52+
inputStream.close();
53+
} catch (Exception e) {
54+
// do nothing
55+
}
56+
}
4757
}
48-
// do nothing
4958
}
5059
}

0 commit comments

Comments
 (0)