[Geoserver-devel] [jira] Created: (GEOS-4127) GetLegendGraphic causes NullPointerException if any SLD rules are missing <Title> tags

GetLegendGraphic causes NullPointerException if any SLD rules are missing <Title> tags
--------------------------------------------------------------------------------------

                 Key: GEOS-4127
                 URL: http://jira.codehaus.org/browse/GEOS-4127
             Project: GeoServer
          Issue Type: Bug
          Components: WMS
    Affects Versions: 2.1-beta1
         Environment: SuSE Enterprise 10, Sun Java 1.6.0_13, Tomcat 5.5.30
            Reporter: Joshua M. Thompson
            Assignee: Andrea Aime

When requesting the legend for a layer, if any of the SLD rules for that layer do not have titles GeoServer will throw a NullPointerException. Adding a non-empty title (even just a single space) fixes the crash, at the expense of having a rather ugly blank line in the legend output.

The culprit seems to be in DefaultRasterLegendProducer.java around line 311:

                    labels[i] = rule.getDescription().getTitle().toString();
                    if (labels[i] == null) labels[i] = rule.getName();
                    if (labels[i] == null) labels[i] = "";

If the title doesn't exist it will try to call toString() on a null pointer.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira