You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/01/03 08:19:54 UTC

[1/2] git commit: CAMEL-7100 Fixed the Scaner close issue in JDK7

Updated Branches:
  refs/heads/master 68fc1ac87 -> ccc92124f


CAMEL-7100 Fixed the Scaner close issue in JDK7


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

Branch: refs/heads/master
Commit: 00a9b02bf5a2c0e5e35d51b7c6dfd3ce2419ae8a
Parents: 68fc1ac
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Jan 3 14:24:34 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Jan 3 14:32:58 2014 +0800

----------------------------------------------------------------------
 .../org/apache/camel/processor/Splitter.java    | 11 +++++----
 .../org/apache/camel/util/GroupIterator.java    | 26 +++++++++++++-------
 .../java/org/apache/camel/util/IOHelper.java    | 17 +++++++++++++
 .../SplitterWithScannerIoExceptionTest.java     |  2 +-
 4 files changed, 41 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/00a9b02b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
index a9dd334..d1a0f64 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
@@ -192,19 +192,20 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
 
         @Override
         public void close() throws IOException {
-            if (value instanceof Closeable) {
-                IOHelper.close((Closeable) value, value.getClass().getName(), LOG);
-            } else if (value instanceof Scanner) {
-                // special for Scanner as it does not implement Closeable
+            if (value instanceof Scanner) {
+                // special for Scanner which implement the Closeable since JDK7 
                 Scanner scanner = (Scanner) value;
                 scanner.close();
-
                 IOException ioException = scanner.ioException();
                 if (ioException != null) {
                     throw ioException;
                 }
+            } else if (value instanceof Closeable) {
+                // we should throw out the exception here   
+                IOHelper.closeWithException((Closeable) value);
             }
         }
+       
     }
 
     private Iterable<ProcessorExchangePair> createProcessorExchangePairsList(Exchange exchange, Object value) {

http://git-wip-us.apache.org/repos/asf/camel/blob/00a9b02b/camel-core/src/main/java/org/apache/camel/util/GroupIterator.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/GroupIterator.java b/camel-core/src/main/java/org/apache/camel/util/GroupIterator.java
index 95a5a1e..158dbed 100644
--- a/camel-core/src/main/java/org/apache/camel/util/GroupIterator.java
+++ b/camel-core/src/main/java/org/apache/camel/util/GroupIterator.java
@@ -65,16 +65,24 @@ public final class GroupIterator implements Iterator<Object>, Closeable {
 
     @Override
     public void close() throws IOException {
-        if (it instanceof Closeable) {
-            IOHelper.close((Closeable) it);
-        } else if (it instanceof Scanner) {
-            // special for Scanner as it does not implement Closeable
-            ((Scanner) it).close();
+        try {
+            if (it instanceof Scanner) {
+                // special for Scanner which implement the Closeable since JDK7 
+                Scanner scanner = (Scanner) it;
+                scanner.close();
+                IOException ioException = scanner.ioException();
+                if (ioException != null) {
+                    throw ioException;
+                }
+            } else if (it instanceof Closeable) {
+                IOHelper.closeWithException((Closeable) it);
+            }
+        } finally {
+            // close the buffer as well
+            bos.close();
+            // we are now closed
+            closed = true;
         }
-        // close the buffer as well
-        bos.close();
-        // we are now closed
-        closed = true;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/00a9b02b/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/IOHelper.java b/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
index efd8b56..ed2f793 100644
--- a/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
@@ -337,6 +337,23 @@ public final class IOHelper {
             }
         }
     }
+    
+    /**
+     * Closes the given resource if it is available and don't catch the exception
+     *
+     * @param closeable the object to close
+     * @throws IOException
+      */
+    public static void closeWithException(Closeable closeable) throws IOException {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (IOException e) {
+                // don't catch the exception here
+                throw e;
+            }
+        }
+    }
 
     /**
      * Closes the given channel if it is available, logging any closing exceptions to the given log.

http://git-wip-us.apache.org/repos/asf/camel/blob/00a9b02b/camel-core/src/test/java/org/apache/camel/processor/SplitterWithScannerIoExceptionTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitterWithScannerIoExceptionTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitterWithScannerIoExceptionTest.java
index 92eaf27..786deb0 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitterWithScannerIoExceptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitterWithScannerIoExceptionTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.builder.RouteBuilder;
 public class SplitterWithScannerIoExceptionTest extends ContextTestSupport {
 
     public void testSplitterStreamingWithError() throws Exception {
-        if (isJavaVersion("1.7") || isPlatform("aix") || isJavaVendor("ibm")) {
+        if (isPlatform("aix") || isJavaVendor("ibm")) {
             return;
         }
 


[2/2] git commit: CAMEL-6126 install the cxf splitup features in camel-cxf

Posted by ni...@apache.org.
CAMEL-6126 install the cxf splitup features in camel-cxf


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

Branch: refs/heads/master
Commit: ccc92124f7639a99e39e701b44fb8401d69622bc
Parents: 00a9b02
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Jan 3 15:19:33 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Jan 3 15:19:33 2014 +0800

----------------------------------------------------------------------
 platforms/karaf/features/src/main/resources/features.xml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ccc92124/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index fc6ccba..57fcfc0 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -214,12 +214,10 @@
   </feature>
   <feature name='camel-cxf' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-spring</feature>
-    <feature>jetty</feature>
-    <feature version='${cxf-version-range}'>cxf</feature>
-    <feature version='${cxf-version-range}'>cxf-specs</feature>
     <feature version='${cxf-version-range}'>cxf-core</feature>
     <feature version='${cxf-version-range}'>cxf-jaxrs</feature>
     <feature version='${cxf-version-range}'>cxf-jaxws</feature>
+    <feature version='${cxf-version-range}'>cxf-http-jetty</feature>
     <feature version='${cxf-version-range}'>cxf-databinding-jaxb</feature>
     <feature version='${cxf-version-range}'>cxf-bindings-soap</feature>
     <bundle>mvn:org.apache.camel/camel-cxf-transport/${project.version}</bundle>