The ConsistencyChecker checkConsistency method can throw RuntimeExceptions, which are never caught by callers. When that occurs, a JS error is shown to the user.
For instance, the URIConsistencyChecker can throw IllegalArgumentExceptions:
java.lang.IllegalArgumentException: protocol = http host = null at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:164) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:871) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:801) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1139) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:397) at org.ametys.cms.transformation.URIConsistencyChecker._checkHTTPLink(URIConsistencyChecker.java:73) at org.ametys.cms.transformation.URIConsistencyChecker.checkConsistency(URIConsistencyChecker.java:149) at org.ametys.cms.clientsideelement.ContentConsistencyTestClientSideElement.getCurrentParameters(ContentConsistencyTestClientSideElement.java:82) [...]
We should catch "Exception" on all calls to checkConsistency, as follows:
CHECK check = CHECK.FAILURE; try { check = checker.checkConsistency(element, shortTest); } catch (Exception e) { // Ignore, consider it a failure. }
To enforce this use, maybe we could make the checkConsistency method explicitly throw Exception.