Solr
  1. Solr
  2. SOLR-991

Add Detail To Configuration XML Parsing Error Messages

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None
    • Environment:

      jdk 1.6+, Tomcat 5.x, 6.x

      Description

      When there is a parsing error in configuration xml files, the error message does not specify which file was being processed or what line caused the parse failure:

      === snip ===
      [Fatal Error] :33:54: The string "--" is not permitted within comments.
      Jan 27, 2009 6:07:54 PM org.apache.solr.common.SolrException log
      SEVERE: org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
      at org.apache.solr.core.Config.<init>(Config.java:104)
      at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:111)
      at org.apache.solr.core.CoreContainer.create(CoreContainer.java:338)
      at org.apache.solr.core.CoreContainer.load(CoreContainer.java:217)
      === snip ===

      As a result, finding minor typos in the config files can take quite a bit of user time. In this case the specific error was an extraneous space in the closing xml comment tag, "-- >" instead of "-->".

      1. SOLR-991.patch
        1 kB
        Shalin Shekhar Mangar

        Activity

        Hide
        Shalin Shekhar Mangar added a comment -

        Patch to log the name of the file (SolrConfig.xml in this case) and then re-throw the exception.

        Solr already logs the start of schema parsing therefore it is easy to identify malformed schema.xml files. Unfortunately, the parser does not give us the exact position of the error.

        I'll commit this shortly.

        Show
        Shalin Shekhar Mangar added a comment - Patch to log the name of the file (SolrConfig.xml in this case) and then re-throw the exception. Solr already logs the start of schema parsing therefore it is easy to identify malformed schema.xml files. Unfortunately, the parser does not give us the exact position of the error. I'll commit this shortly.
        Hide
        Shalin Shekhar Mangar added a comment -

        Committed revision 738916.

        Thanks Michael!

        Show
        Shalin Shekhar Mangar added a comment - Committed revision 738916. Thanks Michael!
        Hide
        Grant Ingersoll added a comment -

        Bulk close for Solr 1.4

        Show
        Grant Ingersoll added a comment - Bulk close for Solr 1.4

          People

          • Assignee:
            Shalin Shekhar Mangar
            Reporter:
            Michael Henson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development