camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r755958 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/converter/ camel-core/src/main/java/org/apache/camel/util/ components/camel-jaxb/src/main/java/org/apache/camel/converter/j...
Date Thu, 19 Mar 2009 12:07:13 GMT
Author: davsclaus
Date: Thu Mar 19 12:07:13 2009
New Revision: 755958

URL: http://svn.apache.org/viewvc?rev=755958&view=rev
Log:
CAMEL-1459: NoTypeConverterException is now checked as its only used by mandatory converters.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
    camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
    camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
    camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaUdpProtocolCodecFactory.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
Thu Mar 19 12:07:13 2009
@@ -21,7 +21,7 @@
  *
  * @version $Revision$
  */
-public class NoTypeConversionAvailableException extends RuntimeCamelException {
+public class NoTypeConversionAvailableException extends CamelException {
     private final Object value;
     private final Class type;
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java Thu Mar 19 12:07:13
2009
@@ -57,7 +57,7 @@
      * @return the converted value, is never <tt>null</tt>
      * @throws NoTypeConversionAvailableException if conversion not possible
      */
-    <T> T mandatoryConvertTo(Class<T> type, Object value);
+    <T> T mandatoryConvertTo(Class<T> type, Object value) throws NoTypeConversionAvailableException;
 
     /**
      * Converts the value to the specified type in the context of an exchange
@@ -71,6 +71,6 @@
      * @return the converted value, is never <tt>null</tt>
      * @throws NoTypeConversionAvailableException} if conversion not possible
      */
-    <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value);
+    <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value)
throws NoTypeConversionAvailableException;
 
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
Thu Mar 19 12:07:13 2009
@@ -99,11 +99,11 @@
         }
     }
 
-    public <T> T mandatoryConvertTo(Class<T> type, Object value) {
+    public <T> T mandatoryConvertTo(Class<T> type, Object value) throws NoTypeConversionAvailableException
{
         return mandatoryConvertTo(type, null, value);
     }
 
-    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object
value) {
+    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object
value) throws NoTypeConversionAvailableException {
         Object answer;
         try {
             answer = doConvertTo(type, exchange, value);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Thu
Mar 19 12:07:13 2009
@@ -260,7 +260,8 @@
     }
 
     @SuppressWarnings("unchecked")
-    private static Object convert(TypeConverter typeConverter, Class type, Object value)
throws URISyntaxException {
+    private static Object convert(TypeConverter typeConverter, Class type, Object value)
+        throws URISyntaxException, NoTypeConversionAvailableException {
         if (typeConverter != null) {
             return typeConverter.mandatoryConvertTo(type, value);
         }

Modified: camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
(original)
+++ camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
Thu Mar 19 12:07:13 2009
@@ -86,7 +86,7 @@
         return convertTo(type, value);
     }
 
-    public <T> T mandatoryConvertTo(Class<T> type, Object value) {
+    public <T> T mandatoryConvertTo(Class<T> type, Object value) throws NoTypeConversionAvailableException
{
         T answer = convertTo(type, value);
         if (answer == null) {
             throw new NoTypeConversionAvailableException(value, type);
@@ -94,7 +94,7 @@
         return answer;
     }
 
-    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object
value) {
+    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object
value) throws NoTypeConversionAvailableException {
         return mandatoryConvertTo(type, value);
     }
 

Modified: camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
(original)
+++ camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
Thu Mar 19 12:07:13 2009
@@ -27,6 +27,7 @@
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.ExpressionBuilder;
 import org.apache.camel.impl.ExpressionAdapter;
 import org.apache.camel.impl.ScheduledPollEndpoint;
@@ -225,7 +226,7 @@
                     if (answer == null) {
                         Object defaultValue = exchange.getIn().getBody();
                         if (defaultValue != null) {
-                            throw new NoTypeConversionAvailableException(defaultValue, type);
+                            throw new RuntimeCamelException(new NoTypeConversionAvailableException(defaultValue,
type));
                         }
 
                         // if we don't have a body then lets instantiate and inject a new
instance

Modified: camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaUdpProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaUdpProtocolCodecFactory.java?rev=755958&r1=755957&r2=755958&view=diff
==============================================================================
--- camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaUdpProtocolCodecFactory.java
(original)
+++ camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaUdpProtocolCodecFactory.java
Thu Mar 19 12:07:13 2009
@@ -21,6 +21,7 @@
 import java.nio.charset.CharsetEncoder;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
@@ -80,7 +81,8 @@
         };
     }
 
-    private ByteBuffer toByteBuffer(Object message, CharsetEncoder encoder) throws CharacterCodingException
{
+    private ByteBuffer toByteBuffer(Object message, CharsetEncoder encoder)
+        throws CharacterCodingException, NoTypeConversionAvailableException {
         String value = context.getTypeConverter().convertTo(String.class, message);
         if (value != null) {
             ByteBuffer answer = ByteBuffer.allocate(value.length()).setAutoExpand(false);



Mime
View raw message