camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: CAMEL-9202: Fixed an issue in flatpack. Thanks to Mykhailo Vlakh for the patch.
Date Thu, 26 Nov 2015 12:21:37 GMT
CAMEL-9202: Fixed an issue in flatpack. Thanks to Mykhailo Vlakh for the patch.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2d5878d2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2d5878d2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2d5878d2

Branch: refs/heads/camel-2.15.x
Commit: 2d5878d2169f73ab1ba8d24f5995b2ec4b346e6b
Parents: 1e6744c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Nov 26 13:20:26 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Nov 26 13:21:27 2015 +0100

----------------------------------------------------------------------
 .../component/flatpack/FlatpackEndpoint.java    | 34 +++++++++++---------
 1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2d5878d2/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackEndpoint.java
b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackEndpoint.java
index b34f63e..9e78022 100644
--- a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackEndpoint.java
+++ b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackEndpoint.java
@@ -46,14 +46,14 @@ import org.apache.camel.util.ResourceHelper;
 /**
  * Processing fixed width or delimited files or messages using the FlatPack library.
  *
- * @version 
+ * @version
  */
 @UriEndpoint(scheme = "flatpack", title = "Flatpack", syntax = "flatpack:type:resourceUri",
consumerClass = FlatpackConsumer.class, label = "transformation")
 public class FlatpackEndpoint extends DefaultPollingEndpoint {
 
     private LoadBalancer loadBalancer = new RoundRobinLoadBalancer();
     private ParserFactory parserFactory = DefaultParserFactory.getInstance();
-   
+
     @UriPath @Metadata(required = "true")
     private FlatpackType type;
     @UriPath @Metadata(required = "true")
@@ -121,11 +121,11 @@ public class FlatpackEndpoint extends DefaultPollingEndpoint {
         InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(),
resourceUri);
         InputStreamReader reader = new InputStreamReader(is);
         Parser parser = getParserFactory().newFixedLengthParser(reader, bodyReader);
-        if (allowShortLines) {
+        if (isAllowShortLines()) {
             parser.setHandlingShortLines(true);
             parser.setIgnoreParseWarnings(true);
         }
-        if (ignoreExtraColumns) {
+        if (isIgnoreExtraColumns()) {
             parser.setIgnoreExtraColumns(true);
             parser.setIgnoreParseWarnings(true);
         }
@@ -134,22 +134,26 @@ public class FlatpackEndpoint extends DefaultPollingEndpoint {
 
     public Parser createDelimitedParser(Exchange exchange) throws InvalidPayloadException,
IOException {
         Reader bodyReader = exchange.getIn().getMandatoryBody(Reader.class);
+
+        Parser parser;
         if (ObjectHelper.isEmpty(getResourceUri())) {
-            return getParserFactory().newDelimitedParser(bodyReader, delimiter, textQualifier);
+            parser = getParserFactory().newDelimitedParser(bodyReader, delimiter, textQualifier);
         } else {
             InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(),
resourceUri);
             InputStreamReader reader = new InputStreamReader(is, IOHelper.getCharsetName(exchange));
-            Parser parser = getParserFactory().newDelimitedParser(reader, bodyReader, delimiter,
textQualifier, ignoreFirstRecord);
-            if (isAllowShortLines()) {
-                parser.setHandlingShortLines(true);
-                parser.setIgnoreParseWarnings(true);
-            }
-            if (isIgnoreExtraColumns()) {
-                parser.setIgnoreExtraColumns(true);
-                parser.setIgnoreParseWarnings(true);
-            }
-            return parser;
+            parser = getParserFactory().newDelimitedParser(reader, bodyReader, delimiter,
textQualifier, ignoreFirstRecord);
         }
+
+        if (isAllowShortLines()) {
+            parser.setHandlingShortLines(true);
+            parser.setIgnoreParseWarnings(true);
+        }
+        if (isIgnoreExtraColumns()) {
+            parser.setIgnoreExtraColumns(true);
+            parser.setIgnoreParseWarnings(true);
+        }
+
+        return parser;
     }
 
 


Mime
View raw message