| Index: src/main/java/org/ini4j/spi/IniParser.java |
| IDEA additional info: |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| <+>x-MacCyrillic |
| =================================================================== |
| --- src/main/java/org/ini4j/spi/IniParser.java (date 1319206062000) |
| +++ src/main/java/org/ini4j/spi/IniParser.java (revision ) |
| @@ -114,10 +114,19 @@ |
| { |
| String sectionName; |
| |
| - if (line.charAt(line.length() - 1) != SECTION_END) |
| + if (line.charAt(line.length() - 1) != SECTION_END) |
| { |
| + int sectionEnd = line.lastIndexOf(SECTION_END); |
| + String afterSectionEnd = line.substring(sectionEnd + 1).trim(); |
| + if (afterSectionEnd.isEmpty() || isComment(afterSectionEnd.charAt(0))) |
| + { |
| + line = line.substring(0, sectionEnd + 1); |
| + } |
| + else |
| + { |
| parseError(line, source.getLineNumber()); |
| - } |
| + } |
| + } |
| |
| sectionName = unescapeFilter(line.substring(1, line.length() - 1).trim()); |
| if ((sectionName.length() == 0) && !getConfig().isUnnamedSection()) |
| @@ -133,5 +142,9 @@ |
| handler.startSection(sectionName); |
| |
| return sectionName; |
| + } |
| + |
| + private boolean isComment(char c) { |
| + return COMMENTS.indexOf(c) >= 0; |
| } |
| } |