* @return instance of jazzy SpellChecker
* @throws SpellCheckException if method failed to load the SpellChecker for lang (it happens if there is no
* dictionaries for that language was found in the classpath
*/
protected Object getChecker(String lang) throws SpellCheckException {
SpellChecker cachedCheker = spellcheckersCache.get(lang);
/**
* Even if the SpellChecker is present we need to validate if the dictionary is available for use,
* and if not we should force a reloading of the SpellChecker for this language.
*
* On some scenarios the dictionary (WEB-INF/dictionary/jmyspell/en_US.zip, WEB-INF/dictionary/jmyspell/es_ES.zip, etc)
* is not longer available even with the SpellChecker object alive causing a java.lang.IllegalStateException, that's why
* a check on the dictionary and a reload is required.
*/
Boolean forceReloading = false;
if ( cachedCheker != null ) {
if ( cachedCheker.getDictionary() == null || !cachedCheker.getDictionary().isLoad() ) {
forceReloading = true;
}
}
if ( cachedCheker == null || forceReloading ) {