Solr
  1. Solr
  2. SOLR-10

Improved error message in Schema Field

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: update
    • Labels:
      None

      Description

      Provide more detail on number format exception. Facilitates debugging from db environment where default values for numeric fields are stored as null, not numbers. Patch to follow

      1. SchemaFieldPatch.txt
        0.9 kB
        Michael Bryzek
      2. FieldTypePatch.txt
        1 kB
        Michael Bryzek

        Activity

        Hide
        Yonik Seeley added a comment -

        I just committed this. Thanks Michael!

        Show
        Yonik Seeley added a comment - I just committed this. Thanks Michael!
        Hide
        Michael Bryzek added a comment -

        Providing the field name on error in FieldType sounds like a better solution. The attached patch adds the field name to the stack trace, e.g.:

        Error while creating field 'longitude

        {type=sfloat,properties=stored}

        ' from value ''org.xmlpull.v1.XmlPullParserException: expected START_TAG or END_TAG not END_DOCUMENT (position: END_DOCUMENT seen ...</doc>\n</add>\n\n... @483:1)
        at org.xmlpull.mxp1.MXParser.nextTag(MXParser.java:1083)
        at org.apache.solr.core.SolrCore.update(SolrCore.java:680)
        at org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
        ...

        Show
        Michael Bryzek added a comment - Providing the field name on error in FieldType sounds like a better solution. The attached patch adds the field name to the stack trace, e.g.: Error while creating field 'longitude {type=sfloat,properties=stored} ' from value ''org.xmlpull.v1.XmlPullParserException: expected START_TAG or END_TAG not END_DOCUMENT (position: END_DOCUMENT seen ...</doc>\n</add>\n\n... @483:1) at org.xmlpull.mxp1.MXParser.nextTag(MXParser.java:1083) at org.apache.solr.core.SolrCore.update(SolrCore.java:680) at org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:767) ...
        Hide
        Yonik Seeley added a comment -

        The current exception contains the bad text that caused the NumberFormatException... I just tried an example and I see
        java.lang.NumberFormatException: For input string: "Hello"

        Is the extra debugging information you need the name of the field?

        If so, perhaps this try/catch should be moved to FIeldType.createField() since that might be called by some code directly.
        The original exception should probably also be chained.

        Show
        Yonik Seeley added a comment - The current exception contains the bad text that caused the NumberFormatException... I just tried an example and I see java.lang.NumberFormatException: For input string: "Hello" Is the extra debugging information you need the name of the field? If so, perhaps this try/catch should be moved to FIeldType.createField() since that might be called by some code directly. The original exception should probably also be chained.

          People

          • Assignee:
            Yonik Seeley
            Reporter:
            Michael Bryzek
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development