File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
main/java/org/springframework/data/redis/connection/convert
test/java/org/springframework/data/redis/connection/convert Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 6363 * @author John Blum
6464 * @author Sorokin Evgeniy
6565 * @author Marcin Grzejszczak
66+ * @author JongJun Kim
6667 */
6768public abstract class Converters {
6869
@@ -107,7 +108,8 @@ public static Properties toProperties(String source) {
107108
108109 Properties info = new Properties ();
109110
110- try (StringReader stringReader = new StringReader (source )) {
111+ String sourceToLoad = source .replace ("\\ " , "\\ \\ " );
112+ try (StringReader stringReader = new StringReader (sourceToLoad )) {
111113 info .load (stringReader );
112114 } catch (Exception ex ) {
113115 throw new RedisSystemException ("Cannot read Redis info" , ex );
Original file line number Diff line number Diff line change 3838 * @author Mark Paluch
3939 * @author Sorokin Evgeniy
4040 * @author Marcin Grzejszczak
41+ * @author JongJun Kim
4142 */
4243class ConvertersUnitTests {
4344
@@ -77,6 +78,13 @@ class ConvertersUnitTests {
7778
7879 private static final String CLUSTER_NODE_WITH_SINGLE_IPV4_HOSTNAME = "3765733728631672640db35fd2f04743c03119c6 10.180.0.33:11003@16379,hostname1 master - 0 1708041426947 2 connected 0-5460" ;
7980
81+ private static final String WINDOWS_INFO_RESPONSE = "# Server\r \n " //
82+ + "redis_version:3.0.504\r \n " //
83+ + "redis_mode:standalone\r \n " //
84+ + "os:Windows\r \n " //
85+ + "executable:C:\\ Program Files\\ Redis\\ redis-server.exe\r \n " //
86+ + "config_file:C:\\ Program Files\\ Redis\\ redis.windows.conf\r \n " ;
87+
8088 @ Test // DATAREDIS-315
8189 void toSetOfRedis30ClusterNodesShouldConvertSingleStringNodesResponseCorrectly () {
8290
@@ -367,4 +375,11 @@ static Stream<Arguments> clusterNodesEndpoints() {
367375
368376 return Stream .concat (regular , weird );
369377 }
378+
379+ @ Test // GH-3099
380+ void toPropertiesShouldParseInfoStringWithWindowsPaths () {
381+
382+ assertThat (Converters .toProperties (WINDOWS_INFO_RESPONSE )).containsEntry ("executable" ,
383+ "C:\\ Program Files\\ Redis\\ redis-server.exe" );
384+ }
370385}
You can’t perform that action at this time.
0 commit comments