Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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