Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b7a5690 authored by David A. Velasco's avatar David A. Velasco
Browse files

Merge pull request #68 from owncloud/close-resource

Close resource in finally block
parents 715a5195 d39d26f8
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -100,6 +100,14 @@ public class Log_OC {

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(mBuf != null) {
                try {
                    mBuf.close();
                } catch(IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

@@ -159,10 +167,15 @@ public class Log_OC {
	            mBuf.newLine();
	            mBuf.write(text);
	            mBuf.newLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        } finally {
                try {
                    mBuf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            // Check if current log file size is bigger than the max file size defined
            if (mLogFile.length() > MAX_FILE_SIZE) {