Crazylychee commented on code in PR #9440:
URL: https://github.com/apache/rocketmq/pull/9440#discussion_r2125411477


##########
common/src/main/java/org/apache/rocketmq/common/MixAll.java:
##########
@@ -334,11 +334,17 @@ public static String properties2String(final Properties 
properties, final boolea
 
     public static Properties string2Properties(final String str) {
         Properties properties = new Properties();
+        String processedStr = str;
+
+        if (isWindows()) {
+            processedStr = str.replace("\\", "\\\\");
+            log.info("Detected Windows OS, escaped backslashes for properties 
string.");
+        }
         try {
-            InputStream in = new 
ByteArrayInputStream(str.getBytes(DEFAULT_CHARSET));
+            InputStream in = new 
ByteArrayInputStream(processedStr.getBytes(DEFAULT_CHARSET));
             properties.load(in);
         } catch (Exception e) {
-            log.error("Failed to handle properties", e);
+            log.error("Failed to handle properties from string: '{}'", 
processedStr, e);
             return null;
         }

Review Comment:
   Changes made: The scope now covers server-side config return methods. A new 
system-type-based escaping method has been encapsulated and integrated into 
these methods. Corresponding unit tests have also been added.



-- 
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]

Reply via email to