You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/03/22 20:29:25 UTC

[2/4] camel git commit: CAMEL-11016-cs fixes

CAMEL-11016-cs fixes


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

Branch: refs/heads/master
Commit: db24f3f71959be6c4f140d2b240758631acf6ac4
Parents: 47f863e
Author: onders86 <on...@gmail.com>
Authored: Sun Mar 19 00:29:12 2017 +0300
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 22 21:23:44 2017 +0100

----------------------------------------------------------------------
 .../dataformat/tarfile/TarFileDataFormat.java   | 18 +++----
 .../camel/dataformat/tarfile/TarIterator.java   | 12 ++---
 .../tarfile/TarFileDataFormatTest.java          | 50 ++++++++++----------
 3 files changed, 40 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/db24f3f7/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarFileDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarFileDataFormat.java b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarFileDataFormat.java
index 1f17f30..d56160b 100644
--- a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarFileDataFormat.java
+++ b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarFileDataFormat.java
@@ -44,7 +44,7 @@ public class TarFileDataFormat extends ServiceSupport implements DataFormat, Dat
     private boolean usingIterator;
     private boolean allowEmptyDirectory;
 
-	@Override
+    @Override
     public String getDataFormatName() {
         return "tarfile";
     }
@@ -87,9 +87,9 @@ public class TarFileDataFormat extends ServiceSupport implements DataFormat, Dat
     @Override
     public Object unmarshal(final Exchange exchange, final InputStream stream) throws Exception {
         if (usingIterator) {
-        	TarIterator tarIterator = new TarIterator(exchange.getIn(), stream);
-        	tarIterator.setAllowEmptyDirectory(allowEmptyDirectory);
-        	return tarIterator;
+            TarIterator tarIterator = new TarIterator(exchange.getIn(), stream);
+            tarIterator.setAllowEmptyDirectory(allowEmptyDirectory);
+            return tarIterator;
         } else {
             BufferedInputStream bis = new BufferedInputStream(stream);
             TarArchiveInputStream tis = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, bis);
@@ -124,12 +124,12 @@ public class TarFileDataFormat extends ServiceSupport implements DataFormat, Dat
     }
     
     public boolean isAllowEmptyDirectory() {
-		return allowEmptyDirectory;
-	}
+        return allowEmptyDirectory;
+    }
 
-	public void setAllowEmptyDirectory(boolean allowEmptyDirectory) {
-		this.allowEmptyDirectory = allowEmptyDirectory;
-	}
+    public void setAllowEmptyDirectory(boolean allowEmptyDirectory) {
+        this.allowEmptyDirectory = allowEmptyDirectory;
+    }
 
     @Override
     protected void doStart() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/db24f3f7/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
index fb1deda..8b7e22a 100644
--- a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
+++ b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
@@ -54,7 +54,7 @@ public class TarIterator implements Iterator<Message>, Closeable {
     private volatile Message parent;
     private boolean allowEmptyDirectory;
 
-	public TarIterator(Message inputMessage, InputStream inputStream) {
+    public TarIterator(Message inputMessage, InputStream inputStream) {
         this.inputMessage = inputMessage;
         //InputStream inputStream = inputMessage.getBody(InputStream.class);
 
@@ -174,10 +174,10 @@ public class TarIterator implements Iterator<Message>, Closeable {
     }
     
     public boolean isAllowEmptyDirectory() {
-		return allowEmptyDirectory;
-	}
+        return allowEmptyDirectory;
+    }
 
-	public void setAllowEmptyDirectory(boolean allowEmptyDirectory) {
-		this.allowEmptyDirectory = allowEmptyDirectory;
-	}
+    public void setAllowEmptyDirectory(boolean allowEmptyDirectory) {
+        this.allowEmptyDirectory = allowEmptyDirectory;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/db24f3f7/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java
index 47fffca..7f8b792 100644
--- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java
+++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java
@@ -16,11 +16,6 @@
  */
 package org.apache.camel.dataformat.tarfile;
 
-import static org.apache.camel.Exchange.FILE_NAME;
-import static org.apache.camel.dataformat.tarfile.TarUtils.TEXT;
-import static org.apache.camel.dataformat.tarfile.TarUtils.getBytes;
-import static org.apache.camel.dataformat.tarfile.TarUtils.getTaredText;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -38,13 +33,17 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.compress.archivers.ArchiveStreamFactory;
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
 import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
 import org.junit.Test;
 
+import static org.apache.camel.Exchange.FILE_NAME;
+import static org.apache.camel.dataformat.tarfile.TarUtils.TEXT;
+import static org.apache.camel.dataformat.tarfile.TarUtils.getBytes;
+import static org.apache.camel.dataformat.tarfile.TarUtils.getTaredText;
+
 /**
  * Unit tests for {@link TarFileDataFormat}.
  */
@@ -235,25 +234,26 @@ public class TarFileDataFormatTest extends CamelTestSupport {
                                          //.streaming()
                                          //.to("file:hello_out?autoCreate=true")
                                          .process(new Processor() {
-                                         @Override
-                                         public void process(Exchange exchange) throws Exception {
-                                        	 InputStream is = new FileInputStream("src/test/resources/data/hello.tar"); 
-                                        	    
-                                        	 TarArchiveEntry entry = new TarArchiveEntry((String)exchange.getIn().getHeader(Exchange.FILE_NAME)); 
-                                    	     File outputFile = new File("hello_out", entry.getName());
-                                    	     if (entry.isDirectory()) {
-                                    	         outputFile.mkdirs();
-                                    	     } else {
-                                    	     	outputFile.getParentFile().mkdirs();
-                                    	       	TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is);
-                                    	       	try {
-                                    	            copy(debInputStream, outputFile);
-                                    	       	} finally {
-                                    	       		debInputStream.close();                                         }
-                                    	       	}
-                                    	     }
-                                        	 
-                                   })
+                                             @Override
+                                             public void process(Exchange exchange) throws Exception {
+                                                 InputStream is = new FileInputStream("src/test/resources/data/hello.tar"); 
+
+                                                 TarArchiveEntry entry = new TarArchiveEntry((String)exchange.getIn().getHeader(Exchange.FILE_NAME)); 
+                                                 File outputFile = new File("hello_out", entry.getName());
+                                                 if (entry.isDirectory()) {
+                                                     outputFile.mkdirs();
+                                                 } else {
+                                                     outputFile.getParentFile().mkdirs();
+                                                     TarArchiveInputStream debInputStream = (TarArchiveInputStream) 
+                                                             new ArchiveStreamFactory().createArchiveInputStream("tar", is);
+                                                     try {
+                                                         copy(debInputStream, outputFile);
+                                                     } finally {
+                                                         debInputStream.close();
+                                                     }
+                                                 }
+                                             }
+                                         })
                                    .end();
                 from("direct:tarAndUntar").marshal(tar).unmarshal(tar).to("mock:tarAndUntar");
                 from("direct:tarToFile").marshal(tar).to("file:" + TEST_DIR.getPath()).to("mock:tarToFile");