-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[WEEX-566][Android] add jsb version file to make jsb.so can update #1437
Conversation
Generated by 🚫 dangerJS |
if(newfile.exists() && versionFile.exists()) { | ||
try { | ||
FileReader fileReader = new FileReader(versionFile); | ||
BufferedReader br = new BufferedReader(fileReader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoke br.close when finishing reading file
versionFile.createNewFile(); | ||
FileWriter fileWriter = new FileWriter(versionFile); | ||
fileWriter.write(String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION)); | ||
fileWriter.flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a more try catch finally clause to close the writer as if there is a exception in line 268, fileWriter would be still open.
da2847f
to
d9ad97b
Compare
if(!versionFile.exists()) | ||
versionFile.createNewFile(); | ||
FileWriter fileWriter = new FileWriter(versionFile); | ||
fileWriter.write(String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If line 277 crashes, the file will still be open.
FileWriter x = null
try{
x= new FileWriter
}finally{
if(x != null) x.close()
}
add jsb version file to make jsb.so can update Bug: WEEX-566 [WEEX-566][Android] add jsb version file to make jsb.so can update add jsb version file to make jsb.so can update Bug: WEEX-566
3f0a69a
to
b0845f9
Compare
try { | ||
if(!versionFile.exists()) | ||
versionFile.createNewFile(); | ||
FileWriter fileWriter = new FileWriter(versionFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move fileWriter
out of the try clause and close the fileWriter
in finally would be better.
https://issues.apache.org/jira/browse/WEEX-566
[WEEX-566][Android] add jsb version file to make jsb.so can update
add jsb version file to make jsb.so can update
Bug: WEEX-566