Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A336110A75 for ; Wed, 29 Jan 2014 21:58:14 +0000 (UTC) Received: (qmail 5428 invoked by uid 500); 29 Jan 2014 21:58:10 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 5408 invoked by uid 500); 29 Jan 2014 21:58:09 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 5266 invoked by uid 99); 29 Jan 2014 21:58:09 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jan 2014 21:58:09 +0000 Date: Wed, 29 Jan 2014 21:58:09 +0000 (UTC) From: "Bas Bosman (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CB-4917) FB - FileUtils.java - may fail to clean up streams MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-4917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bas Bosman updated CB-4917: --------------------------- Component/s: Plugin File > FB - FileUtils.java - may fail to clean up streams > -------------------------------------------------- > > Key: CB-4917 > URL: https://issues.apache.org/jira/browse/CB-4917 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File > Affects Versions: 2.9.0 > Reporter: Peter > Priority: Minor > > Resolve FindBugs issues in *FileUtils.java* > *In copyAction method* > Before > {code} > FileInputStream istream = new FileInputStream(srcFile); > FileOutputStream ostream = new FileOutputStream(destFile); > FileChannel input = istream.getChannel(); > FileChannel output = ostream.getChannel(); > try { > input.transferTo(0, input.size(), output); > } finally { > istream.close(); > ostream.close(); > input.close(); > output.close(); > } > {code} > After > {code} > FileInputStream istream = new FileInputStream(srcFile); > try { > FileOutputStream ostream = new FileOutputStream(destFile); > FileChannel input = istream.getChannel(); > FileChannel output = ostream.getChannel(); > try { > input.transferTo(0, input.size(), output); > } finally { > ostream.close(); > input.close(); > output.close(); > } > } finally { > istream.close(); > } > {code} > *In write method* > Before > {code} > ByteArrayInputStream in = new ByteArrayInputStream(rawData); > FileOutputStream out = new FileOutputStream(filename, append); > byte buff[] = new byte[rawData.length]; > in.read(buff, 0, buff.length); > out.write(buff, 0, rawData.length); > out.flush(); > out.close(); > {code} > After > {code} > ByteArrayInputStream in = new ByteArrayInputStream(rawData); > FileOutputStream out = new FileOutputStream(filename, append); > try { > byte buff[] = new byte[rawData.length]; > in.read(buff, 0, buff.length); > out.write(buff, 0, rawData.length); > out.flush(); > } finally { > out.close(); > } > {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)