Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-849

+ operator on null string concat causes exception

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-1
    • 1.1-beta-2
    • None
    • None
    • Windows 2000, groovy 1.0 jsr-1, jdk 1.4

    Description

      The following program produces an error:

      "
      class Employee {
      String name
      int empId

      String toString()

      { return name + ": " + empId }

      }

      e = new Employee()
      println e
      "

      The error is "Cannot invoke method: plus on null object". What I expect to see is "null: 0". I can see why this is happening but I don't know the best way to fix it.

      Another issue is that when anything goes wrong in groovy, I get a big stacktrace, java style. As a user of the system, I'd rather just see a concise one line error.

      Thanks, keep up the good work. I'm certainly going to keep my eye on this language.
      JJ Furman

      Attachments

        Activity

          People

            paulk Paul King
            jfurman JJ Furman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: