package com.pubnub.api;

public class ChannelGroup {
    String group;
    String namespace;

    ChannelGroup(String name) throws PubnubException {
        String[] parts = name.split(":", 2);

        switch (parts.length) {
            case 2:
                setNamespace(parts[0]);
                setGroup(parts[1]);
                break;
            case 1:
                group = name;
                break;
            default:
                throw new PubnubException("Invalid channel group string");
        }
    }

    public void setGroup(String groupName) {
        if (groupName != null && !"".equals(groupName)) {
            group = groupName;
        }
    }

    public void setNamespace(String namespaceName) {
        if (namespaceName != null && !"".equals(namespaceName)) {
            namespace = namespaceName;
        }
    }
}

@@ -154,30 +154,25 @@
     
-String%5B%5D parts
+int index
  = name.
 spli
@@ -171,20 +171,19 @@
 ame.
-split
+indexOf
 (%22:%22
-, 2
 );%0A%0A
@@ -194,170 +194,71 @@
     
-switch (parts.length) %7B%0A            case 2:%0A                setNamespace(parts%5B0%5D);%0A                setGroup(parts%5B1%5D);%0A                break;%0A            case 1:
+if (index == -1) %7B%0A            setGroup(name);%0A        %7D else %7B
 %0A   
@@ -270,142 +270,94 @@
     
-    group = name;%0A                break;%0A            default:%0A                throw new PubnubException(%22Invalid channel group string%22
+setNamespace(name.substring(0, index));%0A            setGroup(name.substring(index + 1)
 );%0A 

update compatibility with java 1.3