YSLD styling breaks Google Earth KML Output formats

Description

YSLD creates styling object with only the user supplied values. Here is an example where fill-color is provided:

1 2 3 4 5 6 7 8 9 10 11 title: color-green symbolizers: - line: stroke-width: 2.0 stroke-color: '#008000' - text: label: ${LineNumber} font-size: 8 font-family: Arial Black font-style: normal fill-color: Black

The KML Output formats were designed and tested with SLD 1.0 in mind (and assume the parser will fill in default values for anything not supplied by the user).

As an example PlacemarkStyleDecorator assumes fill opacity is always defined:

1 2 3 4 5 6 7 8 9 10 if (fill != null) { Double opacity = fill.getOpacity().evaluate(feature, Double.class); if (opacity == null || Double.isNaN(opacity)) { opacity = 1.0; } Color color = fill.getColor().evaluate(feature, Color.class); ls.setColor(colorToHex(color, opacity)); } else { ls.setColor("ffffffff"); }

This code fails with a style produced by YSLD:

1 2 3 4 Caused by: java.lang.NullPointerException at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLabelStyle(PlacemarkStyleDecoratorFactory.java:290) at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:115) at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:137)

Environment

None

Status

Assignee

Jody Garnett

Reporter

Jody Garnett

Triage

Fix versions

Affects versions

2.12.4

Components

Priority

Medium