(wip) Umsetzung OHNE Nutzung eines java.nio.Filesystem

This commit is contained in:
Andreas Penski (init) 2019-05-07 08:46:24 +02:00 committed by Andreas Penski
parent 7af9b1fdbd
commit 99930a2b0a
14 changed files with 312 additions and 188 deletions

View file

@ -57,6 +57,8 @@ public class Helper {
public static final URI REPOSITORY = EXAMPLES_DIR.resolve("repository/");
public static final URL JAR_REPOSITORY = Helper.class.getClassLoader().getResource("xrechnung/repository/");
public static final URI NOT_EXISTING = EXAMPLES_DIR.resolve("doesnotexist");
public static final URI SAMPLE_DIR = EXAMPLES_DIR.resolve("UBLReady/");
@ -73,18 +75,18 @@ public class Helper {
* @param url die url die geladen werden soll
* @return ein result objekt mit Dokument
*/
public static XdmNode load(URL url) {
try ( InputStream input = url.openStream() ) {
public static XdmNode load(final URL url) {
try ( final InputStream input = url.openStream() ) {
return ObjectFactory.createProcessor().newDocumentBuilder().build(new StreamSource(input));
} catch (SaxonApiException | IOException e) {
} catch (final SaxonApiException | IOException e) {
throw new IllegalStateException("Fehler beim Laden der XML-Datei", e);
}
}
public static <T> T load(URL url, Class<T> type) throws URISyntaxException {
ConversionService c = new ConversionService();
public static <T> T load(final URL url, final Class<T> type) throws URISyntaxException {
final ConversionService c = new ConversionService();
c.initialize(de.kosit.validationtool.model.reportInput.ObjectFactory.class.getPackage(),
de.kosit.validationtool.cmd.assertions.ObjectFactory.class.getPackage(),
de.kosit.validationtool.model.scenarios.ObjectFactory.class.getPackage());