#11 jdk11 support

This commit is contained in:
Penski, Andreas 2019-03-06 14:26:05 +01:00
parent 248f460500
commit 70149817bf
17 changed files with 391 additions and 149 deletions

View file

@ -1,4 +1,4 @@
FROM openjdk:8
FROM openjdk:11
RUN mkdir /opt/validationtool
ADD maven/validationtool-standalone.jar /opt/validationtool

View file

@ -0,0 +1,8 @@
FROM openjdk:8
RUN mkdir /opt/validationtool
ADD maven/validationtool-standalone.jar /opt/validationtool
ADD run.sh /opt/validationtool/
ADD config/ /opt/validationtool/
EXPOSE 8080
ENTRYPOINT ["bash", "/opt/validationtool/run.sh" ]

View file

@ -0,0 +1,8 @@
FROM openjdk:8
RUN mkdir /opt/validationtool
ADD maven/validationtool-standalone.jar /opt/validationtool
ADD run.sh /opt/validationtool/
ADD config/ /opt/validationtool/
EXPOSE 8080
ENTRYPOINT ["bash", "/opt/validationtool/run.sh" ]

View file

@ -1,3 +1,3 @@
#!/usr/bin/env bash
cd /opt/validationtool && java -jar validationtool-standalone.jar -s scenarios.xml -D
cd /opt/validationtool && java -jar validationtool-standalone.jar -s scenarios.xml -D -H 0.0.0.0

View file

@ -28,6 +28,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.DigestInputStream;
@ -226,6 +227,8 @@ public class InputFactory {
byte[] hash = digest.digest();
log.debug("Generated hashcode for {} is {}", name, DatatypeConverter.printHexBinary(hash));
out.flush();
log.info(new String(out.toByteArray(), Charset.forName("utf8")).substring(0,
out.toByteArray().length < 100 ? out.toByteArray().length : 100));
return new Input(out.toByteArray(), name, hash, digest.getAlgorithm());
} catch (IOException e) {
throw new IllegalArgumentException(MESSAGE_OPEN_STREAM_ERROR + name, e);

View file

@ -50,7 +50,7 @@ import net.sf.saxon.s9api.XdmNode;
*/
@Slf4j
@RequiredArgsConstructor
public class CheckAssertionAction implements CheckAction {
class CheckAssertionAction implements CheckAction {
private final Assertions assertions;

View file

@ -135,7 +135,7 @@ public class CommandLineApplication {
printHelp(options);
}
}
return 0;
return returnValue;
}
private static int determinePort(CommandLine cmd) {

View file

@ -68,6 +68,7 @@ class Daemon {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
try {
log.debug("Incoming request");
String requestMethod = httpExchange.getRequestMethod();
if (requestMethod.equals("POST")) {
InputStream inputStream = httpExchange.getRequestBody();
@ -82,7 +83,7 @@ class Daemon {
} else {
writeError(httpExchange, 405, "Es ist nur die POST-Methode erlaubt!");
}
} catch (TransformerException e) {
} catch (Exception e) {
writeError(httpExchange, 500, "Interner Fehler bei der Verarbeitung des Requests: " + e.getMessage());
log.error("Es ist ein Fehler aufgetreten. Das Dokument kann nicht geprüft werden", e);
}
@ -189,7 +190,7 @@ class Daemon {
server.createContext("/health", new HealthHandler(check.getRepository().getScenarios()));
server.setExecutor(Executors.newFixedThreadPool(threadCount));
server.start();
log.info("Server ist erfolgreich gestartet");
log.info("Server unter Port {} ist erfolgreich gestartet", port);
} catch (IOException e) {
log.error("Fehler beim HttpServer erstellen!", e.getMessage(), e);
}

View file

@ -44,7 +44,7 @@ import net.sf.saxon.s9api.XdmNode;
*/
@RequiredArgsConstructor
@Slf4j
public class ExtractHtmlContentAction implements CheckAction {
class ExtractHtmlContentAction implements CheckAction {
private static final QName NAME_ATTRIBUTE = new QName("data-report-type");

View file

@ -30,7 +30,7 @@ import lombok.extern.slf4j.Slf4j;
* @author Andreas Penski
*/
@Slf4j
public class PrintMemoryStats implements de.kosit.validationtool.impl.tasks.CheckAction {
class PrintMemoryStats implements de.kosit.validationtool.impl.tasks.CheckAction {
private static final int BYTES_PER_K = 1024;

View file

@ -35,7 +35,7 @@ import net.sf.saxon.s9api.Serializer;
* @author Andreas Penski
*/
@Slf4j
public class PrintReportAction implements CheckAction {
class PrintReportAction implements CheckAction {
@Override
public void check(Bag results) {

View file

@ -37,7 +37,7 @@ import net.sf.saxon.s9api.Serializer;
*/
@Slf4j
@RequiredArgsConstructor
public class SerializeReportAction implements CheckAction {
class SerializeReportAction implements CheckAction {
private final Path outputDirectory;

View file

@ -70,7 +70,7 @@ public class DocumentParseAction implements CheckAction {
log.debug("Exception while parsing {}", content.getName(), e);
XMLSyntaxError error = new XMLSyntaxError();
error.setSeverity(XMLSyntaxErrorSeverity.SEVERITY_FATAL_ERROR);
error.setMessage(String.format("IOException while reading resource %s", content.getName()));
error.setMessage(String.format("IOException while reading resource %s: %s", content.getName(), e.getMessage()));
result = new Result<>(Collections.singleton(error));
}
@ -84,6 +84,9 @@ public class DocumentParseAction implements CheckAction {
results.setParserResult(parserResult);
v.getXmlSyntaxError().addAll(parserResult.getErrors());
results.getReportInput().setValidationResultsWellformedness(v);
if (parserResult.isInvalid()) {
log.info("Parsing war nicht erfolgreich: {} -> {}", parserResult.getObject(), parserResult.getErrors());
}
}
}