You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "steinerthomas (via GitHub)" <gi...@apache.org> on 2024/04/23 13:52:30 UTC
[PR] [CONFIGURATION-844] Add support for empty sections [commons-configuration]
steinerthomas opened a new pull request, #408:
URL: https://github.com/apache/commons-configuration/pull/408
https://issues.apache.org/jira/browse/CONFIGURATION-844
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "steinerthomas (via GitHub)" <gi...@apache.org>.
steinerthomas commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576600787
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
Hi, I thought to do it the same way as already implemented for the properties. I'll change it to an empty string.
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "steinerthomas (via GitHub)" <gi...@apache.org>.
steinerthomas commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576853397
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
Sorry for the confusion, I mean ini keys (see some lines below:
https://github.com/apache/commons-configuration/blob/1e0744debb7ae39b80b4b702dce3a233a15d02bd/src/main/java/org/apache/commons/configuration2/INIConfiguration.java#L506)
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "steinerthomas (via GitHub)" <gi...@apache.org>.
steinerthomas commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576853397
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
Sorry for the confusion, I mean ini keys (see some lines below)
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576950524
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
Thanks for the reference, better to be consistent.
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #408:
URL: https://github.com/apache/commons-configuration/pull/408
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576848222
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
What do you mean? Properties don't have sections. Where do you see that?
--
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
Re: [PR] CONFIGURATION-844: Add support for empty sections [commons-configuration]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #408:
URL: https://github.com/apache/commons-configuration/pull/408#discussion_r1576307509
##########
src/main/java/org/apache/commons/configuration2/INIConfiguration.java:
##########
@@ -480,7 +485,11 @@ private void createNodeBuilders(final BufferedReader in, final ImmutableNode.Bui
if (!isCommentLine(line)) {
if (isSectionLine(line)) {
final int length = sectionInLineCommentsAllowed ? line.indexOf("]") : line.length() - 1;
- final String section = line.substring(1, length);
+ String section = line.substring(1, length);
+ if (section.isEmpty()) {
+ // use space for sections with no key
+ section = " ";
Review Comment:
Hello @steinerthomas
Thank you for your PR.
Why a space? What about an empty string?
--
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