private void insertSections()

in kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java [149:178]


    private void insertSections(String line, BufferedReader br, Map<String, Object> items) throws IOException {
        while (line.startsWith("[")) {
            int pos = line.indexOf("]");
            if (pos < 2 || pos < line.length() - 1) {
                throw new IOException("Illegal section name: " + line);
            }
            String sectionName = line.substring(1, pos);
            Map<String, Object> entries = new IdentityHashMap<>();
            line = br.readLine();
            if (line == null) {
                break;
            }
            while (!line.isEmpty() && isComment(line)) {
                line = br.readLine();
                if (line == null) {
                    break;
                }
            }
            if (line != null) {
                line = line.trim();
                line = insertEntries(line, br, entries);
                items.put(sectionName, entries);
            }
            /*line has been modified after the recursive.*/
            if (line == null) {
                /*the end of file*/
                break;
            }
        }
    }