camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [3/3] camel git commit: CAMEL-7862 - cs fixes
Date Fri, 10 Mar 2017 12:41:38 GMT
CAMEL-7862 - cs fixes


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

Branch: refs/heads/master
Commit: b27c98c957ba78b3979eb4d7e8b54a90ae36c6b0
Parents: c609efd
Author: onders86 <ondersezgin@gmail.com>
Authored: Fri Mar 10 15:18:44 2017 +0300
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Mar 10 13:37:45 2017 +0100

----------------------------------------------------------------------
 .../camel/dataformat/bindy/BindyCsvFactory.java |  6 ++---
 .../bindy/csv/BindyCsvDataFormat.java           | 26 +++++++++++---------
 ...ySimpleCsvMandatoryFieldsUnmarshallTest.java | 10 ++++----
 3 files changed, 22 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b27c98c9/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 4baaa31..b437835 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -658,7 +658,7 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
         return maxpos;
     }
 
-	public boolean isAllowEmptyStream() {
-		return allowEmptyStream;
-	}
+    public boolean isAllowEmptyStream() {
+        return allowEmptyStream;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b27c98c9/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index 4aa8da6..45b4cd3 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -106,28 +106,30 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
             outputStream.write(bytesCRLF);
         }
     }
-    
+
     /**
      * check emptyStream and if CVSRecord is allow to process emptyStreams
      * avoid IllegalArgumentException and return empty list when unmarshalling
      */
     private boolean checkEmptyStream(BindyCsvFactory factory, InputStream inputStream) throws
IOException {
-    	boolean allowEmptyStream = factory.isAllowEmptyStream();
+        boolean allowEmptyStream = factory.isAllowEmptyStream();
         boolean isStreamEmpty = false;
         boolean canReturnEmptyListOfModels = false;
         
-        if(inputStream == null || inputStream.available() == 0)
-        	isStreamEmpty = true;
+        if (inputStream == null || inputStream.available() == 0) {
+            isStreamEmpty = true;
+        }
         
-        if(isStreamEmpty == true && allowEmptyStream == true)
-        	canReturnEmptyListOfModels = true;
+        if (isStreamEmpty && allowEmptyStream) {
+            canReturnEmptyListOfModels = true;
+        }
         
         return canReturnEmptyListOfModels;
     }
 
     public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception
{
         BindyCsvFactory factory = (BindyCsvFactory)getFactory();
-        ObjectHelper.notNull(factory, "not instantiated");        	
+        ObjectHelper.notNull(factory, "not instantiated");
 
         // List of Pojos
         List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
@@ -137,9 +139,9 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
         InputStreamReader in = null;
         Scanner scanner = null;
         try {
-
-            if (checkEmptyStream(factory,inputStream))
-            	return models;
+            if (checkEmptyStream(factory, inputStream)) {
+                return models;
+            }
     
             in = new InputStreamReader(inputStream, IOHelper.getCharsetName(exchange));
     
@@ -214,10 +216,10 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
             }
 
         } finally {
-            if(scanner != null) {
+            if (scanner != null) {
                 scanner.close();
             }
-            if(in != null) {
+            if (in != null) {
                 IOHelper.close(in, "in", LOG);
             }
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/b27c98c9/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
index 7095782..1501aa8 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
@@ -147,10 +147,10 @@ public class BindySimpleCsvMandatoryFieldsUnmarshallTest extends AbstractJUnit4S
     @DirtiesContext
     @Test
     public void testNonEmptyLineWithAllowEmptyStreamEqualsTrue() throws Exception {
-    	String record3 = "1,A1,Onder,Sezgin,MYC,BB123456789,,,,,"; // mandatory
-    	resultEndpoint3.expectedMessageCount(1);
-    	template3.sendBody(record3);
-    	resultEndpoint3.assertIsSatisfied();
+        String record3 = "1,A1,Onder,Sezgin,MYC,BB123456789,,,,,"; // mandatory
+        resultEndpoint3.expectedMessageCount(1);
+        template3.sendBody(record3);
+        resultEndpoint3.assertIsSatisfied();
     }
 
     @DirtiesContext
@@ -190,7 +190,7 @@ public class BindySimpleCsvMandatoryFieldsUnmarshallTest extends AbstractJUnit4S
     public static class ContextConfig extends RouteBuilder {
         BindyCsvDataFormat formatOptional = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
         BindyCsvDataFormat formatMandatory = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory.Order.class);
-        BindyCsvDataFormat formatEmptyStream= new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassemptystream.Order.class);
+        BindyCsvDataFormat formatEmptyStream = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassemptystream.Order.class);
 
         public void configure() {
             from("direct:start1").unmarshal(formatOptional).to("mock:result1");


Mime
View raw message