public class ChainableInternalResourceViewResolver extends InternalResourceViewResolver {
@Override
protected AbstractUrlBasedView buildView(String viewName) throws Exception {
String url = getPrefix() + viewName + getSuffix();
if (getServletContext().getResourceAsStream(url) == null) {
return new NonExistentView();
}
return super.buildView(viewName);
}
private static class NonExistentView extends AbstractUrlBasedView {
@Override
protected boolean isUrlRequired() {
return false;
}
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Purposely empty, it should never get called
}
/**
* Resource check should always return false
*/
@Override
public boolean checkResource(Locale locale) throws Exception {
return false;
}
}
}
However, we get the MaximumInheritanceDepth issue in SonarQube, which I think is a false positive, since we are making use of a framework that we don't have control out of. In this specific case, we simply extend one class from the Spring Framework.
Could the rule be adapted so the number of parents are calculated internally, regardless of the framework used? I think it would be more logical.
Thank you