diff --git a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java index a7b3b4049..3b086ab3f 100644 --- a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java +++ b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java @@ -1014,7 +1014,7 @@ public class Check extends Update { * * @throws BuildException if the task was not configured correctly. */ - private void validateConfiguration() throws BuildException { + private synchronized void validateConfiguration() throws BuildException { if (path == null) { throw new BuildException("No project dependencies have been defined to analyze."); } diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java index 2641bf8f5..3132778b4 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java @@ -137,7 +137,7 @@ public final class CpeMemoryIndex { * * @return whether or not the index is open */ - public boolean isOpen() { + public synchronized boolean isOpen() { return openState; } @@ -274,7 +274,7 @@ public final class CpeMemoryIndex { * @return the Document * @throws IOException thrown if there is an IOException */ - public Document getDocument(int documentId) throws IOException { + public synchronized Document getDocument(int documentId) throws IOException { return indexSearcher.doc(documentId); } @@ -283,7 +283,7 @@ public final class CpeMemoryIndex { * * @return the number of CPE entries stored in the index */ - public int numDocs() { + public synchronized int numDocs() { if (indexReader == null) { return -1; }