You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2018/01/30 08:41:26 UTC

[camel] 02/02: CAMEL-12198: Remove PGDataSource type check as some container implementations may wrap it using a different class

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8a735b1616c90bee761fdda78dc2c4858d5e568f
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Jan 30 08:38:55 2018 +0000

    CAMEL-12198: Remove PGDataSource type check as some container implementations may wrap it using a different class
---
 .../camel/component/pgevent/PgEventEndpoint.java     | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
index 0d304ef..18c28a2 100644
--- a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
+++ b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
@@ -16,12 +16,10 @@
  */
 package org.apache.camel.component.pgevent;
 
-import java.io.InvalidClassException;
 import java.sql.DriverManager;
 import javax.sql.DataSource;
 
 import com.impossibl.postgres.api.jdbc.PGConnection;
-import com.impossibl.postgres.jdbc.PGDataSource;
 import com.impossibl.postgres.jdbc.PGDriver;
 
 import org.apache.camel.Consumer;
@@ -140,22 +138,14 @@ public class PgEventEndpoint extends DefaultEndpoint {
         return new PgEventProducer(this);
     }
 
-    private void validateInputs() throws InvalidClassException, IllegalArgumentException {
+    private void validateInputs() throws IllegalArgumentException {
         if (getChannel() == null || getChannel().length() == 0) {
             throw new IllegalArgumentException("A required parameter was not set when creating this Endpoint (channel)");
         }
-        if (datasource != null) {
-            LOG.debug("******Datasource detected*****");
-            if (!PGDataSource.class.isInstance(datasource)) {
-                throw new InvalidClassException("The datasource passed to the "
-                        + "pgevent component is NOT a PGDataSource class from the"
-                        + "pgjdbc-ng library. See: https://github.com/impossibl/pgjdbc-ng");
-            }
-        } else {
-            if (user == null) {
-                throw new IllegalArgumentException("A required parameter was "
-                        + "not set when creating this Endpoint (pgUser or pgDataSource)");
-            }
+
+        if (datasource == null && user == null) {
+            throw new IllegalArgumentException("A required parameter was "
+                    + "not set when creating this Endpoint (pgUser or pgDataSource)");
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
jamesnetherton@apache.org.