// Path: honeybadger-java/src/main/java/io/honeybadger/util/HBStringUtils.java
// public final class HBStringUtils {
//     private HBStringUtils() { }
// 
//     /**
//      * Removes a single character from the end of a string if it matches.
//      * @param input String to remove from, if null returns null
//      * @param c character to match
//      * @return Original string minus matched character
//      */
//     public static String stripTrailingChar(final String input, final char c) {
//         if (input == null) return null;
//         if (input.isEmpty()) return input;
// 
//         char[] charArray = input.toCharArray();
// 
//         if (charArray[charArray.length - 1] == c) {
//             return new String(Arrays.copyOf(charArray, charArray.length - 1));
//         } else {
//             return input;
//         }
//     }
// 
//     /**
//      * Checks a string to see if it is null or empty.
//      * @param string String to check
//      * @return true if null or empty
//      */
//     public static boolean isPresent(final String string) {
//         return string != null && !string.isEmpty();
//     }
// }


import com.typesafe.config.Config;
import com.typesafe.config.ConfigValue;
import io.honeybadger.util.HBStringUtils;
import org.slf4j.LoggerFactory;
import play.Environment;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

    /**
     * Flattens a hierarchical map of nested maps into a single map with each
     * nesting delineated by a dot.
     * @param map nested map
     * @param level level of nesting
     * @return a flat map
     */
    static Map<String, Object> flattenNestedMap(final Map<String, Object> map, final long level) {
        if (map.isEmpty()) return Collections.emptyMap();

        Map<String, Object> flat = new HashMap<>();

        for (final Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getKey() == null || entry.getKey().isEmpty()) continue;

            if (entry.getValue() instanceof Map) {
                // assume that we have the same underlying generic definition
                @SuppressWarnings("unchecked")
                Map<String, Object> innerMap = (Map<String, Object>) entry.getValue();

                // Don't bother to continue processing if this config section is empty
                if (innerMap.isEmpty()) continue;

                Map<String, Object> subFlat = flattenNestedMap(innerMap, level + 1);

                Iterator<Map.Entry<String, Object>> subItr = subFlat.entrySet().iterator();

                while (subItr.hasNext()) {
                    Map.Entry<String, Object> subEntry = subItr.next();
// Path: honeybadger-java/src/main/java/io/honeybadger/util/HBStringUtils.java
// public final class HBStringUtils {
//     private HBStringUtils() { }
// 
//     /**
//      * Removes a single character from the end of a string if it matches.
//      * @param input String to remove from, if null returns null
//      * @param c character to match
//      * @return Original string minus matched character
//      */
//     public static String stripTrailingChar(final String input, final char c) {
//         if (input == null) return null;
//         if (input.isEmpty()) return input;
// 
//         char[] charArray = input.toCharArray();
// 
//         if (charArray[charArray.length - 1] == c) {
//             return new String(Arrays.copyOf(charArray, charArray.length - 1));
//         } else {
//             return input;
//         }
//     }
// 
//     /**
//      * Checks a string to see if it is null or empty.
//      * @param string String to check
//      * @return true if null or empty
//      */
//     public static boolean isPresent(final String string) {
//         return string != null && !string.isEmpty();
//     }
// }


// Path: honeybadger-java/src/main/java/io/honeybadger/reporter/config/PlayConfigContext.java
import com.typesafe.config.Config;
import com.typesafe.config.ConfigValue;
import io.honeybadger.util.HBStringUtils;
import org.slf4j.LoggerFactory;
import play.Environment;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;


    /**
     * Flattens a hierarchical map of nested maps into a single map with each
     * nesting delineated by a dot.
     * @param map nested map
     * @param level level of nesting
     * @return a flat map
     */
    static Map<String, Object> flattenNestedMap(final Map<String, Object> map, final long level) {
        if (map.isEmpty()) return Collections.emptyMap();

        Map<String, Object> flat = new HashMap<>();

        for (final Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getKey() == null || entry.getKey().isEmpty()) continue;

            if (entry.getValue() instanceof Map) {
                // assume that we have the same underlying generic definition
                @SuppressWarnings("unchecked")
                Map<String, Object> innerMap = (Map<String, Object>) entry.getValue();

                // Don't bother to continue processing if this config section is empty
                if (innerMap.isEmpty()) continue;

                Map<String, Object> subFlat = flattenNestedMap(innerMap, level + 1);

                Iterator<Map.Entry<String, Object>> subItr = subFlat.entrySet().iterator();

                while (subItr.hasNext()) {
                    Map.Entry<String, Object> subEntry = subItr.next();
                    String subKey = HBStringUtils.stripTrailingChar(subEntry.getKey(), '.');