stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasintha <...@git.apache.org>
Subject [GitHub] stratos pull request: Fixing STRATOS-1632 and updating cep and das...
Date Fri, 20 May 2016 03:34:13 GMT
Github user Jasintha commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/496#discussion_r63987283
  
    --- Diff: components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
---
    @@ -44,48 +43,58 @@ public void testThriftClientConfigParser() throws Exception {
             URL configFileUrl = ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
             System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, configFileUrl.getPath());
             ThriftClientConfig thriftClientConfig = ThriftClientConfig.getInstance();
    -        List <ThriftClientInfo> cepList = thriftClientConfig.getThriftClientInfo(
    +        List<ThriftClientInfo> cepList = thriftClientConfig.getThriftClientInfo(
                     ThriftClientConfig.CEP_THRIFT_CLIENT_NAME);
    -        List <ThriftClientInfo> dasList = thriftClientConfig.getThriftClientInfo(
    +        List<ThriftClientInfo> dasList = thriftClientConfig.getThriftClientInfo(
                     ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
             ThriftClientInfo cepNode1 = null;
             ThriftClientInfo cepNode2 = null;
             ThriftClientInfo dasNode1 = null;
    -        
    +        ThriftClientInfo dasNode2 = null;
    +
             for (ThriftClientInfo cepNodeInfo : cepList) {
    -			if(cepNodeInfo.getId().equals("node-01")) {
    -				cepNode1 = cepNodeInfo;
    -			}else if(cepNodeInfo.getId().equals("node-02")) {
    -				cepNode2 = cepNodeInfo;
    -			}
    -		}
    -                
    +            if (cepNodeInfo.getId().equals("node-01")) {
    --- End diff --
    
    better to use constant first approach when doing string comparison to avoid the NPE ,
ex 
    if("node-01".equals(cepNodeInfo.getId()))


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message