You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/01/23 21:48:49 UTC
[maven-doxia-linkcheck] 01/01: make thread safe
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch thread
in repository https://gitbox.apache.org/repos/asf/maven-doxia-linkcheck.git
commit ca802bd3b6f39474d48d4dd9181ae0fefabfdfca
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Thu Jan 23 16:48:35 2020 -0500
make thread safe
---
.../java/org/apache/maven/doxia/linkcheck/LinkMatcher.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/maven/doxia/linkcheck/LinkMatcher.java b/src/main/java/org/apache/maven/doxia/linkcheck/LinkMatcher.java
index 1da4726..0e25af4 100644
--- a/src/main/java/org/apache/maven/doxia/linkcheck/LinkMatcher.java
+++ b/src/main/java/org/apache/maven/doxia/linkcheck/LinkMatcher.java
@@ -49,9 +49,6 @@ class LinkMatcher
Pattern.compile( "<(?>link|a|img|script)[^>]*?(?>href|src)\\s*?=\\s*?[\\\"'](.*?)[\\\"'][^>]*?",
Pattern.CASE_INSENSITIVE );
- /** No need to create a new object each time a file is processed. Just clear it. */
- private static final Set<String> LINK_LIST = new TreeSet<>();
-
private LinkMatcher()
{
// nop
@@ -92,7 +89,8 @@ class LinkMatcher
static Set<String> match( File file, String encoding )
throws IOException
{
- LINK_LIST.clear();
+
+ Set<String> linkSet = new TreeSet<>();
final Matcher m = MATCH_PATTERN.matcher( toString( file, encoding ) );
@@ -117,9 +115,9 @@ class LinkMatcher
// continue;
// }
- LINK_LIST.add( link );
+ linkSet.add( link );
}
- return LINK_LIST;
+ return linkSet;
}
}