Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-4413

JS errors on consistency checker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.4.2, 3.5
    • 3.4.1
    • None
    • None

      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.

            ngavalda Nicolas Gavalda (Inactive)
            ngavalda Nicolas Gavalda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: