You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/10/18 22:18:17 UTC

[GitHub] [commons-configuration] BranislavBeno commented on pull request #229: CONFIGURATION-822: Fix ambiguity on the section determining

BranislavBeno commented on PR #229:
URL: https://github.com/apache/commons-configuration/pull/229#issuecomment-1283072066

   > Which INI specification are you implementing? AFIK a semicolon for a comment is only legal at the start of a line (https://en.m.wikipedia.org/wiki/INI_file)
   
   Honestly, none particular.
   But @kinow has, IMHO, correctly pointed out, that some implementations allow inline comments.
   
   What should I do in case I have to process INI file with inline comments?
   Should I choose an implementation, which allows inline comments?
   Or should I reinvent the wheel and implement my own solution?
   
   And is it really correct behavior to refuse section determining, just because it contains inline comment?
   But only in case this comment doesn't end with closing square bracket, otherwise the section is determined, however with obviously wrong section name.
   
   I fully understand your concerns, that my proposal could violate backwards compatibility.
   
   How about following solution?
   ``` java
       private boolean inLineCommentsAllowed = false;
   
       public INIConfiguration(boolean inLineCommentsAllowed) {
           this.inLineCommentsAllowed = inLineCommentsAllowed;
       }
   
       public INIConfiguration() {
       }
   
   ...
   ```
   
   Field will be initialized only on instantiation. No setter will be available.
   With field set to `false` will INI file parsing proceed backwards compatible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org