Skip to content

Commit 4fc9747

Browse files
committed
Defensive concurrent access to key set from java.util.Properties
Closes gh-23063
1 parent b37390b commit 4fc9747

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spring-core/src/main/java/org/springframework/core/env/PropertiesPropertySource.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
*/
3636
public class PropertiesPropertySource extends MapPropertySource {
3737

38-
@SuppressWarnings({"unchecked", "rawtypes"})
38+
@SuppressWarnings({"rawtypes", "unchecked"})
3939
public PropertiesPropertySource(String name, Properties source) {
4040
super(name, (Map) source);
4141
}
@@ -44,4 +44,12 @@ protected PropertiesPropertySource(String name, Map<String, Object> source) {
4444
super(name, source);
4545
}
4646

47+
48+
@Override
49+
public String[] getPropertyNames() {
50+
synchronized (this.source) {
51+
return super.getPropertyNames();
52+
}
53+
}
54+
4755
}

0 commit comments

Comments
 (0)