You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2019/08/20 10:08:28 UTC
[commons-lang] 01/03: [LANG-1476] Added sync for iterating over
synced set
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit d20e4f53af58315f2d7d79c235c90b3e76717607
Author: emopers <em...@gmail.com>
AuthorDate: Wed Jan 9 03:35:27 2019 -0600
[LANG-1476] Added sync for iterating over synced set
---
src/main/java/org/apache/commons/lang3/CharSet.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java
index 21e7e17..3fdfd07 100644
--- a/src/main/java/org/apache/commons/lang3/CharSet.java
+++ b/src/main/java/org/apache/commons/lang3/CharSet.java
@@ -237,9 +237,11 @@ public class CharSet implements Serializable {
* @return {@code true} if the set contains the characters
*/
public boolean contains(final char ch) {
- for (final CharRange range : set) {
- if (range.contains(ch)) {
- return true;
+ synchronized(set) {
+ for (final CharRange range : set) {
+ if (range.contains(ch)) {
+ return true;
+ }
}
}
return false;