camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1162796 - /camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
Date Mon, 29 Aug 2011 13:26:10 GMT
Author: cschneider
Date: Mon Aug 29 13:26:10 2011
New Revision: 1162796

URL: http://svn.apache.org/viewvc?rev=1162796&view=rev
Log:
Avoid reference from model to converter

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java?rev=1162796&r1=1162795&r2=1162796&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
Mon Aug 29 13:26:10 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.model;
 
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -23,7 +26,6 @@ import javax.xml.bind.annotation.XmlRoot
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.Processor;
-import org.apache.camel.converter.IOConverter;
 import org.apache.camel.processor.ConvertBodyProcessor;
 import org.apache.camel.spi.Required;
 import org.apache.camel.spi.RouteContext;
@@ -73,6 +75,16 @@ public class ConvertBodyDefinition exten
     public String getLabel() {
         return "convertBodyTo[" + getType() + "]";
     }
+    
+    public static void validateCharset(String charset) throws UnsupportedCharsetException
{
+        if (charset != null) {
+            if (Charset.isSupported(charset)) {
+                Charset.forName(charset);
+                return;
+            }
+        }
+        throw new UnsupportedCharsetException(charset);
+    }
 
     @Override
     public Processor createProcessor(RouteContext routeContext) throws Exception {
@@ -82,7 +94,7 @@ public class ConvertBodyDefinition exten
 
         // validate charset
         if (charset != null) {
-            IOConverter.validateCharset(charset);
+            validateCharset(charset);
         }
 
         return new ConvertBodyProcessor(getTypeClass(), getCharset());



Mime
View raw message