camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zregv...@apache.org
Subject camel git commit: CAMEL-10915 Add type conversion support for jav...
Date Wed, 01 Mar 2017 12:15:47 GMT
Repository: camel
Updated Branches:
  refs/heads/master e6fe23bb9 -> 19d23bac3


CAMEL-10915 Add type conversion support for jav...

...a.net.URI

Fixed the converter after code review.


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

Branch: refs/heads/master
Commit: 19d23bac37d1ea5ebd3f77f0a51ab66fad50792e
Parents: e6fe23b
Author: Zoran Regvart <zregvart@apache.org>
Authored: Wed Mar 1 13:15:06 2017 +0100
Committer: Zoran Regvart <zregvart@apache.org>
Committed: Wed Mar 1 13:15:29 2017 +0100

----------------------------------------------------------------------
 .../apache/camel/impl/converter/UriTypeConverter.java   | 12 +++---------
 .../camel/impl/converter/UriTypeConverterTest.java      |  5 -----
 2 files changed, 3 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/19d23bac/camel-core/src/main/java/org/apache/camel/impl/converter/UriTypeConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/UriTypeConverter.java
b/camel-core/src/main/java/org/apache/camel/impl/converter/UriTypeConverter.java
index aab8e14..8572aca 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/UriTypeConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/UriTypeConverter.java
@@ -29,18 +29,12 @@ import org.apache.camel.TypeConverter;
 public class UriTypeConverter {
 
     @Converter
-    public static CharSequence toCharSequence(final Object value) {
-        final URI uri = toUri(value);
-
-        return uri.toString();
+    public static CharSequence toCharSequence(final URI value) {
+        return value.toString();
     }
 
     @Converter
-    public static URI toUri(final Object value) {
-        if (value instanceof URI) {
-            return (URI)value;
-        }
-
+    public static URI toUri(final CharSequence value) {
         final String stringValue = String.valueOf(value);
 
         try {

http://git-wip-us.apache.org/repos/asf/camel/blob/19d23bac/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
b/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
index 9cb4289..5b6a9d0 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
@@ -32,11 +32,6 @@ public class UriTypeConverterTest {
     static final String INVALID = ":";
 
     @Test(expected = TypeConversionException.class)
-    public void shouldComplainOnInvalidStringUrisConvertingToStrings() {
-        UriTypeConverter.toCharSequence(INVALID);
-    }
-
-    @Test(expected = TypeConversionException.class)
     public void shouldComplainOnInvalidStringUrisConvertingToUri() {
         UriTypeConverter.toUri(INVALID);
     }


Mime
View raw message