/**
 *  Copyright 2012 Rackspace
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.rackspacecloud.client.service_registry.clients;

import com.google.gson.reflect.TypeToken;
import com.rackspacecloud.client.service_registry.ClientResponse;
import com.rackspacecloud.client.service_registry.containers.ConfigurationValuesContainer;
import com.rackspacecloud.client.service_registry.containers.ServicesContainer;
import com.rackspacecloud.client.service_registry.objects.ConfigurationValue;
import com.rackspacecloud.client.service_registry.objects.Service;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.message.BasicNameValuePair;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ConfigurationClient extends BaseClient {
    public ConfigurationClient(AuthClient authClient) {
        super(authClient);
    }

    public List<ConfigurationValue> list(Map<String, String> options) throws Exception {
        return list(options, null);
    }

    public List<ConfigurationValue> list(Map<String, String> options, String namespace) throws Exception {
        String url = "/configuration";

        Type type = new TypeToken<ConfigurationValuesContainer>() {}.getType();
        List<NameValuePair> params = new ArrayList<NameValuePair>();

        if (namespace != null) {
            // Make sure leading and trailing forward slashes are present

            if (namespace.indexOf("/") != 0)  {
                url += "/" + namespace;
            }
            else {
                url += namespace;
            }

            if (namespace.lastIndexOf("/") != namespace.length() - 1) {
                url += "/";
            }
        }

        ClientResponse response = this.performRequest(url, params, new HttpGet(), true, type);

        ConfigurationValuesContainer container = (ConfigurationValuesContainer)response.getBody();
        return container.getValues();
    }

    public ConfigurationValue get(String id) throws Exception {
        ClientResponse response = this.performRequest("/configuration/" + id, null, new HttpGet(), true, ConfigurationValue.class);

        return (ConfigurationValue)response.getBody();
    }

    public ConfigurationClient set(String id, String value) throws Exception {
        ConfigurationValue cv = new ConfigurationValue(null, value);
        this.performRequestWithPayload("/configuration/"+ id, null, new HttpPut(), cv, false, null);
        return this;
    }
}

@@ -2090,32 +2090,33 @@
             if (
+!
 namespace.indexO
@@ -2113,25 +2113,23 @@
 ace.
-indexOf(%22/%22) != 0
+startsWith(%22/%22)
 )  %7B
@@ -2271,38 +2271,9 @@
 if (
-namespace.lastIndexOf(%22/%22) != 
+!
 name
@@ -2282,20 +2282,21 @@
 ace.
-l
 en
-gth() - 1
+dsWith(%22/%22)
 ) %7B%0A

Use startsWith and endsWith.