/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.guacamole.properties;

import java.util.Properties;
import org.apache.guacamole.GuacamoleException;

/**
 * GuacamoleProperties implementation which reads all properties from a
 * {@link Properties} object. Whitespace at the end of property values is
 * automatically trimmed.
 */
public class PropertiesGuacamoleProperties implements GuacamoleProperties {

    /**
     * The Properties from which all property values should be read.
     */
    private final Properties properties;

    /**
     * Creates a new PropertiesGuacamoleProperties which wraps the given
     * {@link Properties}, providing access to the values of any properties
     * defined therein.
     *
     * @param properties
     *     The Properties that should be used as the source of all property
     *     values exposed by this instance of PropertiesGuacamoleProperties.
     */
    public PropertiesGuacamoleProperties(Properties properties) {
        this(properties);
    }


    @Override
    public String getProperty(String name) throws GuacamoleException {

        String value = properties.getProperty(name);
        if (value == null)
            return null;

        return value.trim();

    }

}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.guacamole.properties;

import java.util.Properties;
import org.apache.guacamole.GuacamoleException;

/**
 * GuacamoleProperties implementation which reads all properties from a
 * {@link Properties} object. Whitespace at the end of property values is
 * automatically trimmed.
 */
public class PropertiesGuacamoleProperties implements GuacamoleProperties {

    /**
     * The Properties from which all property values should be read.
     */
    private final Properties properties;

    /**
     * Creates a new PropertiesGuacamoleProperties which wraps the given
     * {@link Properties}, providing access to the values of any properties
     * defined therein.
     *
     * @param properties
     *     The Properties that should be used as the source of all property
     *     values exposed by this instance of PropertiesGuacamoleProperties.
     */
    public PropertiesGuacamoleProperties(Properties properties) {
        this.properties = properties;
    }


    @Override
    public String getProperty(String name) throws GuacamoleException {

        String value = properties.getProperty(name);
        if (value == null)
            return null;

        return value.trim();

    }

}

Merge revert incorrect recursive constructor invocation.