Skip to content

Commit

Permalink
Stop using xml parser with raster content
Browse files Browse the repository at this point in the history
  • Loading branch information
sebr72 committed Jun 13, 2024
1 parent ddc87a7 commit 4db9ae3
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions core/src/main/java/org/mapfish/print/map/style/SLDParserPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class SLDParserPlugin implements StyleParserPlugin {
*/
public static final String STYLE_INDEX_REF_SEPARATOR = "##";

public static final String RASTER = "raster";

@Override
public final Optional<Style> parseStyle(
@Nullable final Configuration configuration,
Expand Down Expand Up @@ -85,6 +87,9 @@ private Optional<Style> tryLoadSLD(
Assert.isTrue(
styleIndex == null || styleIndex > -1, "styleIndex must be > -1 but was: " + styleIndex);

if (RASTER.equals(new String(bytes))) {
return Optional.empty();
}
final Style[] styles;
try {

Expand Down Expand Up @@ -163,27 +168,19 @@ public static class ErrorHandler extends DefaultHandler {

private static final Logger LOGGER = LoggerFactory.getLogger(ErrorHandler.class);

/**
* @param e Exception
*/
public final void error(final SAXParseException e) throws SAXException {
LOGGER.debug("XML error: {}", e.getLocalizedMessage());
LOGGER.warn("XML error: {}", e.getLocalizedMessage(), e);
super.error(e);
}

/**
* @param e Exception
*/
public final void fatalError(final SAXParseException e) throws SAXException {
LOGGER.debug("XML fatal error: {}", e.getLocalizedMessage());
LOGGER.warn("XML fatal error: {}", e.getLocalizedMessage(), e);
super.fatalError(e);
}

/**
* @param e Exception
*/
public final void warning(final SAXParseException e) {
// ignore
public final void warning(final SAXParseException e) throws SAXException {
LOGGER.warn("XML warning: {}", e.getLocalizedMessage(), e);
super.warning(e);
}
}
}

0 comments on commit 4db9ae3

Please sign in to comment.