protected Map loadQueries()

in src/main/java/org/apache/commons/dbutils/QueryLoader.java [110:131]


    protected Map<String, String> loadQueries(final String path) throws IOException {
        // Findbugs flags getClass().getResource as a bad practice; maybe we should change the API?
        final Properties props;
        try (InputStream in = getClass().getResourceAsStream(path)) {

            if (in == null) {
                throw new IllegalArgumentException(path + " not found.");
            }
            props = new Properties();
            if (dotXml.matcher(path).matches()) {
                props.loadFromXML(in);
            } else {
                props.load(in);
            }
        }

        // Copy to HashMap for better performance

        @SuppressWarnings({"rawtypes", "unchecked" }) // load() always creates <String,String> entries
        final HashMap<String, String> hashMap = new HashMap(props);
        return hashMap;
    }