protected Integer mapThrowableFlat(Throwable throwable) {
        Class<? extends Throwable> throwableClass = throwable.getClass();
        Integer resId = throwableToMsgIdMap.get(throwableClass);
        if (resId == null) {
            Class<? extends Throwable> closestClass = null;
            Set<Entry<Class<? extends Throwable>, Integer>> mappings = throwableToMsgIdMap.entrySet();
            for (Entry<Class<? extends Throwable>, Integer> mapping : mappings) {
                Class<? extends Throwable> candidate = mapping.getKey();
                if (candidate.isAssignableFrom(throwableClass)) {
                    if (closestClass == null || closestClass.isAssignableFrom(candidate)) {
                        closestClass = candidate;
                        resId = mapping.getValue();
                    }
                }
            }

        }
        return resId;
    }
protected Integer mapThrowableFlat(Throwable throwable) {
        Class<? extends Throwable> throwableClass = throwable.getClass();
        Integer resId = throwableToMsgIdMap.get(throwableClass);
        if (resId == null) {
            Class<? extends Throwable> closestClass = null;
            Set<Entry<Class<? extends Throwable>, Integer>> mappings = throwableToMsgIdMap.entrySet();
            for (Entry<Class<? extends Throwable>, Integer> mapping : mappings) {
                Class<? extends Throwable> candidate = mapping.getKey();
                if (candidate.isAssignableFrom(throwableClass)) {
                    if (closestClass == null || closestClass.isAssignableFrom(candidate)) {
                        closestClass = candidate;
                        resId = mapping.getValue();
                    }
                }
            }

        }
        return resId;
    }
protected Integer mapThrowableFlat ( Throwable throwable ) { Class < ? extends Throwable > throwableClass = throwable . getClass ( ) ; Integer resId = throwableToMsgIdMap . get ( throwableClass ) ; if ( resId == null ) { Class < ? extends Throwable > closestClass = null ; Set < Entry < Class < ? extends Throwable > , Integer > > mappings = throwableToMsgIdMap . entrySet ( ) ; for ( Entry < Class < ? extends Throwable > , Integer > mapping : mappings ) { Class < ? extends Throwable > candidate = mapping . getKey ( ) ; if ( candidate . isAssignableFrom ( throwableClass ) ) { if ( closestClass == null || closestClass . isAssignableFrom ( candidate ) ) { closestClass = candidate ; resId = mapping . getValue ( ) ; } } } } return resId ; }
Mapping without checking the cause (done in mapThrowable).
Mapping without checking the cause ( done in mapThrowable ) .