Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSMFP-23 #3328

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.List;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
Expand Down Expand Up @@ -63,7 +64,8 @@ public final Configuration getConfig(final File configFile, final InputStream co
configuration.setConfigurationFile(configFile);
MapfishPrintConstructor.setConfigurationUnderConstruction(configuration);

final Configuration config = this.yaml.load(new InputStreamReader(configData, "UTF-8"));
final Configuration config =
this.yaml.load(new InputStreamReader(configData, StandardCharsets.UTF_8));
if (this.doValidation) {
final List<Throwable> validate = config.validate();
if (!validate.isEmpty()) {
Expand Down
24 changes: 11 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 @@ -5,6 +5,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -39,6 +40,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 +88,9 @@ private Optional<Style> tryLoadSLD(
Assert.isTrue(
styleIndex == null || styleIndex > -1, "styleIndex must be > -1 but was: " + styleIndex);

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

Expand Down Expand Up @@ -163,27 +169,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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,18 @@ public final void shutdown() {
}

private void executeJob(final PrintJob job) {
LOGGER.debug(
"executeJob {}, PoolSize {}, CorePoolSize {}, Active {}, Completed {}, Task {}, isShutdown"
+ " {}, isTerminated {}",
job,
this.executor.getPoolSize(),
this.executor.getCorePoolSize(),
this.executor.getActiveCount(),
this.executor.getCompletedTaskCount(),
this.executor.getTaskCount(),
this.executor.isShutdown(),
this.executor.isTerminated());

final Future<PrintJobResult> future = this.executor.submit(job);
this.runningTasksFutures.put(
job.getEntry().getReferenceId(), new SubmittedPrintJob(future, job.getEntry()));
Expand Down Expand Up @@ -482,7 +494,6 @@ private boolean isTimeoutExceeded(final SubmittedPrintJob printJob) {
* If the status of a print job is not checked for a while, we assume that the user is no longer
* interested in the report, and we cancel the job.
*
* @param printJob
* @return is the abandoned timeout exceeded?
*/
private boolean isAbandoned(final SubmittedPrintJob printJob) {
Expand Down
Loading