Skip to content

Commit

Permalink
Merge pull request #1 from Intellisrc/fix-issue-318
Browse files Browse the repository at this point in the history
fix issue perwendel#318 change HashMap to ConcurrentHashMap
  • Loading branch information
lepe authored Jul 4, 2022
2 parents 584b17f + af6fba5 commit fef4318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/spark/ExceptionMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ExceptionMapper {

Expand Down Expand Up @@ -52,7 +53,7 @@ public synchronized static ExceptionMapper getServletInstance() {
* Class constructor
*/
public ExceptionMapper() {
this.exceptionMap = new HashMap<>();
this.exceptionMap = new ConcurrentHashMap<>();
}

/**
Expand Down Expand Up @@ -94,7 +95,8 @@ public ExceptionHandlerImpl getHandler(Class<? extends Exception> exceptionClass

// No handler found either for the superclasses of the exception class
// We cache the null value to prevent future
this.exceptionMap.put(exceptionClass, null);
// We do not need to cache the null value. comment by lloyd.
// this.exceptionMap.put(exceptionClass, null);
return null;
}

Expand Down

0 comments on commit fef4318

Please sign in to comment.