cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [2/3] git commit: Allow to set username and password on ConnectionFactory
Date Wed, 30 Apr 2014 14:25:19 GMT
Allow to set username and password on ConnectionFactory


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

Branch: refs/heads/master
Commit: b5e2667dc0ad34d00e5d838877fe0c1a5255474c
Parents: 882bda5
Author: Christian Schneider <chris@die-schneider.net>
Authored: Wed Apr 30 16:24:23 2014 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Wed Apr 30 16:24:23 2014 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/transport/jms/JMSFactory.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b5e2667d/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
index f3ae29e..4eaf083 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
@@ -97,8 +97,11 @@ public final class JMSFactory {
     }
 
     public static Connection createConnection(JMSConfiguration jmsConfig) throws JMSException
{
-        Connection connection = jmsConfig.getConnectionFactory().createConnection(jmsConfig.getUserName(),
-                                                                                  jmsConfig.getPassword());
+        String username = jmsConfig.getUserName();
+        ConnectionFactory cf = jmsConfig.getConnectionFactory();
+        Connection connection = username != null 
+            ? cf.createConnection(username, jmsConfig.getPassword())
+            : cf.createConnection();
         if (jmsConfig.getDurableSubscriptionClientId() != null) {
             connection.setClientID(jmsConfig.getDurableSubscriptionClientId());
         }


Mime
View raw message