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 2012/12/18 09:04:31 UTC

svn commit: r1423309 - in /camel/branches/camel-2.10.x: ./ components/camel-http/src/main/java/org/apache/camel/component/http/ components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/ tests/camel-itest/src/test/java/org/apache/camel/itest/...

Author: ningjiang
Date: Tue Dec 18 08:04:30 2012
New Revision: 1423309

URL: http://svn.apache.org/viewvc?rev=1423309&view=rev
Log:
CAMEL-5890 fixed the NPE when jaxb fallbackConverter is used with RequestEntityConverter
Merged revisions 1423299,1423304 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1423299 | ningjiang | 2012-12-18 15:06:50 +0800 (Tue, 18 Dec 2012) | 1 line
  
  CAMEL-5890 fixed the NPE when jaxb fallbackConverter is used with RequestEntityConverter
........
  r1423304 | ningjiang | 2012-12-18 15:41:58 +0800 (Tue, 18 Dec 2012) | 1 line
  
  CAMEL-5890 Fixed the CS error of JaxbFallbackTypeConverterTest
........

Added:
    camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java
      - copied, changed from r1423299, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java
    camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/
      - copied from r1423299, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/
    camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/Bar.java
      - copied unchanged from r1423299, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/Bar.java
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java
    camel/branches/camel-2.10.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1423299,1423304

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java?rev=1423309&r1=1423308&r2=1423309&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java (original)
+++ camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java Tue Dec 18 08:04:30 2012
@@ -48,7 +48,7 @@ public final class RequestEntityConverte
 
     @Converter
     public static RequestEntity toRequestEntity(String str, Exchange exchange) throws Exception {
-        if (GZIPHelper.isGzip(exchange.getIn())) {
+        if (exchange != null && GZIPHelper.isGzip(exchange.getIn())) {
             byte[] data = exchange.getContext().getTypeConverter().convertTo(byte[].class, str);
             return asRequestEntity(data, exchange);
         } else {

Modified: camel/branches/camel-2.10.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java?rev=1423309&r1=1423308&r2=1423309&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java (original)
+++ camel/branches/camel-2.10.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java Tue Dec 18 08:04:30 2012
@@ -219,7 +219,8 @@ public class FallbackTypeConverter exten
             } else {
                 marshaller.marshal(value, buffer);
             }
-            answer = parentTypeConverter.convertTo(type, buffer.toString());
+            // we need to pass the exchange
+            answer = parentTypeConverter.convertTo(type, exchange, buffer.toString());
         }
 
         return answer;

Copied: camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java (from r1423299, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java)
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java?p2=camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java&p1=camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java&r1=1423299&r2=1423309&rev=1423309&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java (original)
+++ camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java Tue Dec 18 08:04:30 2012
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.camel.itest.jaxb;
 
 import java.io.InputStream;