cychiu8 commented on code in PR #10840:
URL: https://github.com/apache/ozone/pull/10840#discussion_r3652409315


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/conf/ConfigurationFieldsTests.java:
##########
@@ -668,6 +677,43 @@ public void testDefaultValueCollision() {
       LOG.info("Checked {} default values for collision.", valuesChecked);
     }
 
+  }
+
+  /**
+   * Verifies no default value in the XML embeds a line break, which would
+   * corrupt the runtime string (see HDDS-8046). Legitimate cases opt out via
+   * {@link #xmlPropsAllowedToContainNewline}. Unlike the comparison tests, 
this
+   * reads the raw XML directly so it is not narrowed by
+   * {@code xmlPropsToSkipCompare}/{@code xmlPrefixToSkipCompare}: every 
property
+   * is checked, and the only exemption is {@link 
#xmlPropsAllowedToContainNewline}.
+   */
+  @Test
+  public void testXmlValuesHaveNoEmbeddedNewlines() {
+    assertNotNull(xmlFilename);
+    Configuration conf = new Configuration(false);
+    conf.setAllowNullValueProperties(true);
+    conf.addResource(xmlFilename);
+
+    Set<String> xmlValuesWithNewlines = new TreeSet<>();
+    for (Map.Entry<String, String> entry : conf) {
+      String value = entry.getValue();
+      if (value == null) {
+        continue;
+      }
+      if (xmlPropsAllowedToContainNewline.contains(entry.getKey())) {
+        LOG.info("XML Property: {} AllowedToContainNewline", entry.getKey());
+        continue;
+      }
+      if (value.indexOf('\n') != -1 || value.indexOf('\r') != -1) {
+        xmlValuesWithNewlines.add(entry.getKey());
+      }
+    }
 
+    assertTrue(xmlValuesWithNewlines.isEmpty(),

Review Comment:
   Thank you for the review and feedback! I've addressed it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to