jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1452109 - /jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java
Date Sun, 03 Mar 2013 19:39:43 GMT
Author: pmouawad
Date: Sun Mar  3 19:39:42 2013
New Revision: 1452109

URL: http://svn.apache.org/r1452109
Log:
Bug 54584 - MongoDB plugin
Add constant for port
Cleanup code
Bugzilla Id: 54584

Modified:
    jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java

Modified: jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java?rev=1452109&r1=1452108&r2=1452109&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java
(original)
+++ jmeter/trunk/src/protocol/mongodb/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java
Sun Mar  3 19:39:42 2013
@@ -23,19 +23,25 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.mongodb.ServerAddress;
 
 /**
  */
 public class MongoUtils {
+    /**
+     * MongoDB default connection port
+     */
+    public static final int DEFAULT_PORT = 27017;
 
     public static List<ServerAddress> toServerAddresses(String connections) throws
UnknownHostException {
 
         List<ServerAddress> addresses = new ArrayList<ServerAddress>();
         for(String connection : Arrays.asList(connections.split(","))) {
-            int port = 27017;
+            int port = DEFAULT_PORT;
             String[] hostPort = connection.split(":");
-            if(hostPort.length > 1 && hostPort[1] != null) {
+            if(hostPort.length > 1 && !StringUtils.isEmpty(hostPort[1])) {
                 port = Integer.parseInt(hostPort[1].trim());
             }
             addresses.add(new ServerAddress(hostPort[0], port));



Mime
View raw message