mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	Merge pull request #68 from owncloud/close-resource
Close resource in finally block
This commit is contained in:
		
						commit
						1b7a569040
					
				| @ -60,7 +60,7 @@ public class Log_OC { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     public static void w(String TAG, String message) { |     public static void w(String TAG, String message) { | ||||||
|         Log.w(TAG,message); |         Log.w(TAG, message); | ||||||
|         appendLog(TAG+" : "+ message); |         appendLog(TAG+" : "+ message); | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @ -100,6 +100,14 @@ public class Log_OC { | |||||||
| 
 | 
 | ||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
|             e.printStackTrace(); |             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.newLine(); | ||||||
| 	            mBuf.write(text); | 	            mBuf.write(text); | ||||||
| 	            mBuf.newLine(); | 	            mBuf.newLine(); | ||||||
|  | 	        } catch (IOException e) { | ||||||
|  | 	            e.printStackTrace(); | ||||||
|  | 	        } finally { | ||||||
|  |                 try { | ||||||
|                     mBuf.close(); |                     mBuf.close(); | ||||||
|                 } catch (IOException e) { |                 } catch (IOException e) { | ||||||
|                     e.printStackTrace(); |                     e.printStackTrace(); | ||||||
|                 } |                 } | ||||||
|  |             } | ||||||
| 
 | 
 | ||||||
|             // Check if current log file size is bigger than the max file size defined |             // Check if current log file size is bigger than the max file size defined | ||||||
|             if (mLogFile.length() > MAX_FILE_SIZE) { |             if (mLogFile.length() > MAX_FILE_SIZE) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user