private Configuration getUniqueConfig()

in src/main/java/org/apache/sling/launchpad/testservices/servlets/GetConfigServlet.java [99:114]


    private Configuration getUniqueConfig(String pid) throws ServletException {
        final String filter = "(service.pid=" + pid + ")";
        Configuration [] cfg = null;
        try {
            cfg = configAdmin.listConfigurations(filter);
        } catch(Exception e) {
            throw new ServletException("Error listing configs with filter " + filter, e);
        }
        if(cfg == null) {
            throw new ServletException("No config found with filter " + filter);
        }
        if(cfg.length > 1) {
            throw new ServletException("Expected 1 config, found " + cfg.length + " with filter " + filter);
        }
        return cfg[0];
    }