Github user anuruddhal commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/432#discussion_r36939478
  
    --- Diff: 
components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
 ---
    @@ -98,6 +97,31 @@ private static String 
createPortMappingPayloadString(Cartridge cartridge) {
             return portMappingString;
         }
     
    +    private static String createPortMappingsToPayloadString(Cartridge 
cartridge) {
    +
    +        // port mappings
    +        StringBuilder portMapBuilder = new StringBuilder();
    +        PortMapping[] portMappings = cartridge.getPortMappings();
    +
    +        if (cartridge.getPortMappings()[0] == null) {
    +            // first element is null, which means no port mappings.
    +            return null;
    +        }
    +
    +        for (PortMapping portMapping : portMappings) {
    +            int port = portMapping.getPort();
    +            
//'NAME:mgt-console|PROTOCOL:https|PORT:30649|PROXY_PORT:0|TYPE:NodePort
    +            
portMapBuilder.append(String.format("NAME:%s|PROTOCOL:%s|PORT:%d|PROXY_PORT:%d|TYPE:%s;",
    +                    portMapping.getName(), portMapping.getProtocol(),
    +                    portMapping.getPort(), portMapping.getProxyPort(),
    +                    portMapping.getKubernetesPortType()));
    +        }
    +        //remove last ;
    +        String portMappingString = 
portMapBuilder.toString().replaceAll(";$", "");
    +        return portMappingString;
    --- End diff --
    
    This is the the regex to remove last ";" character from the string


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to