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 63
63
* @author John Blum
64
64
* @author Sorokin Evgeniy
65
65
* @author Marcin Grzejszczak
66
+ * @author JongJun Kim
66
67
*/
67
68
public abstract class Converters {
68
69
@@ -107,7 +108,8 @@ public static Properties toProperties(String source) {
107
108
108
109
Properties info = new Properties ();
109
110
110
- try (StringReader stringReader = new StringReader (source )) {
111
+ String sourceToLoad = source .replace ("\\ " , "\\ \\ " );
112
+ try (StringReader stringReader = new StringReader (sourceToLoad )) {
111
113
info .load (stringReader );
112
114
} catch (Exception ex ) {
113
115
throw new RedisSystemException ("Cannot read Redis info" , ex );
Original file line number Diff line number Diff line change 38
38
* @author Mark Paluch
39
39
* @author Sorokin Evgeniy
40
40
* @author Marcin Grzejszczak
41
+ * @author JongJun Kim
41
42
*/
42
43
class ConvertersUnitTests {
43
44
@@ -77,6 +78,13 @@ class ConvertersUnitTests {
77
78
78
79
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" ;
79
80
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
+
80
88
@ Test // DATAREDIS-315
81
89
void toSetOfRedis30ClusterNodesShouldConvertSingleStringNodesResponseCorrectly () {
82
90
@@ -367,4 +375,11 @@ static Stream<Arguments> clusterNodesEndpoints() {
367
375
368
376
return Stream .concat (regular , weird );
369
377
}
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
+ }
370
385
}
You can’t perform that action at this time.
0 commit comments