Adds a section if it doesn't exist yet. @param name the name of the section @return true if the section didn't already exist @throws IllegalArgumentException the name is illegal, ie contains one of the characters '[' and ']' or consists only of white sp
(String name)
| 336 | * of the characters '[' and ']' or consists only of white space |
| 337 | */ |
| 338 | public boolean addSection(String name) { |
| 339 | String normName = normSection(name); |
| 340 | if (!hasSection(normName)) { |
| 341 | // Section constructor might throw IllegalArgumentException |
| 342 | Section section = new Section(normName, this.commentDelims, |
| 343 | this.isCaseSensitive); |
| 344 | section.setOptionFormat(this.optionFormat); |
| 345 | this.sections.put(normName, section); |
| 346 | this.sectionOrder.add(normName); |
| 347 | return true; |
| 348 | } else { |
| 349 | return false; |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Removes a section if it exists. |
no test coverage detected