1. jaxp
  2. JAXP-39

Improve error message when an uninitialized variable is used


    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:


      Filing this RFE based on Peter Lenahan's suggestion. The problem he encountered is described here,


      and here is his suggestion:

      "But I wonder if a better error message scheme could somehow be generated.
      XSLT is often hard to debug and without a clue to where the problem happened it
      is really impossible. Just a null pointer exception message is a killer.

      Perhaps my un-initialized null variables could be initialized with an internal
      error message reference, so if the style sheet references one of these
      un-initialized variables, an error message string could be displayed instead of
      just crashing with a null pointer exception. I realized that this is a lot of
      work to add code to all the functions that work on the string variables, but
      XSLT is not exactly a friendly language without knowing where your problems are
      occurring. It would really help a lot to know where the problems originated.

      This may not be a perfect solution and perhaps the feature should also only be
      available when the setAttribute("debug",new Boolean(true)) is turned on.

      On the page: http://www.unicode.org/charts/PDF/UE000.pdf it defines private use
      UNICODE characters.

      Consider this possible feature.

      if (factory.getAttribute("debug"))

      { // // When you declare a variable initialize the variable // with a special character and reference to the // filename, line number // and character offset of the declaring variable. // Clearly this would need to be checked in hundreds of places // for the special first character. // char [] hidden=new char[1]; hidden[0]=0xE000; // This is a special use UNICODE Character. String special=hidden.toString()+ filenameReference+ linenumberReference+ characterOffsetReference; }

      Then when using the string if this value was set, it would tell the
      internal function that it was incorrect and where the problem

      My problem was in a 6000 line style sheet which made the problem a little
      difficult to find and understand."



          • Assignee:
            Santiago Pericas-Geertsen
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: