camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-9158: camel-univocity-parsers should initize in doStart and not use reset flag
Date Fri, 23 Oct 2015 15:03:39 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x dd466beb8 -> 487252ae7


CAMEL-9158: camel-univocity-parsers should initize in doStart and not use reset flag


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

Branch: refs/heads/camel-2.16.x
Commit: 487252ae713ad967b81e356495dcd43e2666271e
Parents: dd466be
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Fri Oct 23 16:58:30 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Oct 23 17:03:15 2015 +0200

----------------------------------------------------------------------
 components/camel-univocity-parsers/pom.xml      | 12 ++++++++
 .../univocity/AbstractUniVocityDataFormat.java  | 31 +++-----------------
 .../univocity/UniVocityCsvDataFormat.java       |  4 ---
 .../UniVocityFixedWidthDataFormat.java          |  4 ---
 .../univocity/UniVocityTsvDataFormat.java       |  1 -
 5 files changed, 16 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/487252ae/components/camel-univocity-parsers/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/pom.xml b/components/camel-univocity-parsers/pom.xml
index 51e551d..61ce4ca 100644
--- a/components/camel-univocity-parsers/pom.xml
+++ b/components/camel-univocity-parsers/pom.xml
@@ -78,4 +78,16 @@
         </dependency>
     </dependencies>
 
+    <build>
+      <plugins>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <forkCount>1</forkCount>
+            <reuseForks>false</reuseForks>
+          </configuration>
+        </plugin>
+      </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/487252ae/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
index 39faf37..5ba5494 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
@@ -39,8 +39,6 @@ import static org.apache.camel.util.IOHelper.getCharsetName;
 /**
  * This abstract class contains all the common parts for all the uniVocity parsers.
  * <p/>
- * All setters methods <b>must</b> call the {@link #reset()} method in order
to clear the cache for marshalling and
- * unmarshalling.
  *
  * @param <F>   uniVocity format class
  * @param <CWS> uniVocity writer settings class
@@ -150,7 +148,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setNullValue(String nullValue) {
         this.nullValue = nullValue;
-        reset();
         return self();
     }
 
@@ -175,7 +172,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setSkipEmptyLines(Boolean skipEmptyLines) {
         this.skipEmptyLines = skipEmptyLines;
-        reset();
         return self();
     }
 
@@ -200,7 +196,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setIgnoreTrailingWhitespaces(Boolean ignoreTrailingWhitespaces) {
         this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
-        reset();
         return self();
     }
 
@@ -225,7 +220,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setIgnoreLeadingWhitespaces(Boolean ignoreLeadingWhitespaces) {
         this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
-        reset();
         return self();
     }
 
@@ -252,7 +246,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setHeadersDisabled(boolean headersDisabled) {
         this.headersDisabled = headersDisabled;
-        reset();
         return self();
     }
 
@@ -277,7 +270,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setHeaders(String[] headers) {
         this.headers = headers;
-        reset();
         return self();
     }
 
@@ -302,7 +294,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setHeaderExtractionEnabled(Boolean headerExtractionEnabled) {
         this.headerExtractionEnabled = headerExtractionEnabled;
-        reset();
         return self();
     }
 
@@ -327,7 +318,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setNumberOfRecordsToRead(Integer numberOfRecordsToRead) {
         this.numberOfRecordsToRead = numberOfRecordsToRead;
-        reset();
         return self();
     }
 
@@ -352,7 +342,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setEmptyValue(String emptyValue) {
         this.emptyValue = emptyValue;
-        reset();
         return self();
     }
 
@@ -377,7 +366,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setLineSeparator(String lineSeparator) {
         this.lineSeparator = lineSeparator;
-        reset();
         return self();
     }
 
@@ -402,7 +390,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setNormalizedLineSeparator(Character normalizedLineSeparator) {
         this.normalizedLineSeparator = normalizedLineSeparator;
-        reset();
         return self();
     }
 
@@ -427,7 +414,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setComment(Character comment) {
         this.comment = comment;
-        reset();
         return self();
     }
 
@@ -448,7 +434,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setLazyLoad(boolean lazyLoad) {
         this.lazyLoad = lazyLoad;
-        reset();
         return self();
     }
 
@@ -469,7 +454,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
      */
     public DF setAsMap(boolean asMap) {
         this.asMap = asMap;
-        reset();
         return self();
     }
 
@@ -551,16 +535,6 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
     }
 
     /**
-     * Resets the caches. It <b>must</b> be called when a setter is called.
-     */
-    protected void reset() {
-        writerSettings = null;
-        marshaller = null;
-        parserSettings = null;
-        unmarshaller = null;
-    }
-
-    /**
      * Creates and configures the writer settings.
      *
      * @return new configured instance of the writer settings
@@ -621,7 +595,10 @@ public abstract class AbstractUniVocityDataFormat<F extends Format,
CWS extends
 
     @Override
     protected void doStart() throws Exception {
-        // noop
+        writerSettings = null;
+        marshaller = null;
+        parserSettings = null;
+        unmarshaller = null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/487252ae/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormat.java
b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormat.java
index 99a8da9..4505f47 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormat.java
@@ -54,7 +54,6 @@ public class UniVocityCsvDataFormat extends AbstractUniVocityDataFormat<CsvForma
      */
     public UniVocityCsvDataFormat setQuoteAllFields(Boolean quoteAllFields) {
         this.quoteAllFields = quoteAllFields;
-        reset();
         return this;
     }
 
@@ -79,7 +78,6 @@ public class UniVocityCsvDataFormat extends AbstractUniVocityDataFormat<CsvForma
      */
     public UniVocityCsvDataFormat setQuote(Character quote) {
         this.quote = quote;
-        reset();
         return this;
     }
 
@@ -104,7 +102,6 @@ public class UniVocityCsvDataFormat extends AbstractUniVocityDataFormat<CsvForma
      */
     public UniVocityCsvDataFormat setQuoteEscape(Character quoteEscape) {
         this.quoteEscape = quoteEscape;
-        reset();
         return this;
     }
 
@@ -129,7 +126,6 @@ public class UniVocityCsvDataFormat extends AbstractUniVocityDataFormat<CsvForma
      */
     public UniVocityCsvDataFormat setDelimiter(Character delimiter) {
         this.delimiter = delimiter;
-        reset();
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/487252ae/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java
b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java
index f9b125d..c68daf7 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java
@@ -55,7 +55,6 @@ public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<F
      */
     public UniVocityFixedWidthDataFormat setFieldLengths(int[] fieldLengths) {
         this.fieldLengths = fieldLengths;
-        reset();
         return this;
     }
 
@@ -78,7 +77,6 @@ public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<F
      */
     public UniVocityFixedWidthDataFormat setSkipTrailingCharsUntilNewline(Boolean skipTrailingCharsUntilNewline)
{
         this.skipTrailingCharsUntilNewline = skipTrailingCharsUntilNewline;
-        reset();
         return this;
     }
 
@@ -101,7 +99,6 @@ public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<F
      */
     public UniVocityFixedWidthDataFormat setRecordEndsOnNewline(Boolean recordEndsOnNewline)
{
         this.recordEndsOnNewline = recordEndsOnNewline;
-        reset();
         return this;
     }
 
@@ -126,7 +123,6 @@ public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<F
      */
     public UniVocityFixedWidthDataFormat setPadding(Character padding) {
         this.padding = padding;
-        reset();
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/487252ae/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
index 2e980fd..1038e8b 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
@@ -51,7 +51,6 @@ public class UniVocityTsvDataFormat extends AbstractUniVocityDataFormat<TsvForma
      */
     public UniVocityTsvDataFormat setEscapeChar(Character escapeChar) {
         this.escapeChar = escapeChar;
-        reset();
         return this;
     }
 


Mime
View raw message