No initialization check in ExtensionMimeDetector
Brought to you by:
smcardle
ExtensionMimeDetector uses a static variable which is intialized by the constructor, but there is no check to see if the static variable is already initialized. That can cause a ConcurrentModificationException if two threads are asking for a new ExtensionMimeDetector, they will both tried to set the extMimeTypes static variable at the same time...
proposed solution: don't call the init method if already initialized
public ExtensionMimeDetector() {
//check if already initialized, if yes do nothing
if (extMimeTypes == null) {
ExtensionMimeDetector.initMimeTypes();
}
}
proposed solution