Defensive concurrent access to key set from java.util.Properties

Closes gh-23063
This commit is contained in:
Juergen Hoeller 2019-06-11 20:56:57 +02:00
parent b37390b8fe
commit 4fc9747569
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ import java.util.Properties;
*/
public class PropertiesPropertySource extends MapPropertySource {
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({"rawtypes", "unchecked"})
public PropertiesPropertySource(String name, Properties source) {
super(name, (Map) source);
}
@ -44,4 +44,12 @@ public class PropertiesPropertySource extends MapPropertySource {
super(name, source);
}
@Override
public String[] getPropertyNames() {
synchronized (this.source) {
return super.getPropertyNames();
}
}
}