You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2013/12/26 17:06:29 UTC
git commit: CAMEL-7080: Fixed the failing unit-tests of camel-csv
which was a side effect of the previous commit.
Updated Branches:
refs/heads/master bfd516ae8 -> 564406554
CAMEL-7080: Fixed the failing unit-tests of camel-csv which was a side effect of the previous commit.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/56440655
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/56440655
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/56440655
Branch: refs/heads/master
Commit: 5644065541e3efb85fd5113fc2b2d5738bc0865e
Parents: bfd516a
Author: Babak Vahdat <bv...@apache.org>
Authored: Thu Dec 26 17:06:22 2013 +0100
Committer: Babak Vahdat <bv...@apache.org>
Committed: Thu Dec 26 17:06:22 2013 +0100
----------------------------------------------------------------------
.../org/apache/camel/dataformat/csv/CsvDataFormat.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/56440655/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
index cfce7fa..aff2d2a 100644
--- a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
+++ b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
@@ -103,16 +103,22 @@ public class CsvDataFormat implements DataFormat {
strategy.setDelimiter(config.getDelimiter());
InputStreamReader in = new InputStreamReader(inputStream, IOHelper.getCharsetName(exchange));
- CsvIterator csvIterator;
+ boolean closeStream = false;
+ CsvIterator csvIterator = null;
try {
CSVParser parser = createParser(in);
if (parser == null) {
+ closeStream = true;
// return an empty Iterator
return ObjectHelper.createIterator(null);
}
csvIterator = new CsvIterator(parser, in);
+ } catch (IOException ioe) {
+ closeStream = true;
} finally {
- IOHelper.close(in);
+ if (closeStream) {
+ IOHelper.close(in);
+ }
}
if (lazyLoad) {
return csvIterator;