Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[WEEX-566][Android] add jsb version file to make jsb.so can update #1437

Merged
merged 1 commit into from
Aug 16, 2018

Conversation

Darin726
Copy link
Contributor

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

@weex-bot
Copy link

weex-bot commented Aug 15, 2018

Fails
🚫 Failed to run assembleDebug task for android.
Messages
📖 android build verification finished.

Generated by 🚫 dangerJS

if(newfile.exists() && versionFile.exists()) {
try {
FileReader fileReader = new FileReader(versionFile);
BufferedReader br = new BufferedReader(fileReader);
Copy link
Contributor

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();
Copy link
Contributor

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.

if(!versionFile.exists())
versionFile.createNewFile();
FileWriter fileWriter = new FileWriter(versionFile);
fileWriter.write(String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION));
Copy link
Contributor

@YorkShen YorkShen Aug 16, 2018

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
try {
if(!versionFile.exists())
versionFile.createNewFile();
FileWriter fileWriter = new FileWriter(versionFile);
Copy link
Contributor

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.

@YorkShen YorkShen merged commit 8d1b3c4 into apache:master Aug 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants