more tests

This commit is contained in:
Andreas Penski (init) 2020-05-01 13:47:40 +02:00
parent 7abc072911
commit 1a001a1af4
6 changed files with 115 additions and 4 deletions

View file

@ -57,7 +57,7 @@ public class SchemaBuilder implements Builder<Pair<ValidateWithXmlSchema, Schema
final ValidateWithXmlSchema o = new ValidateWithXmlSchema();
final ResourceType r = new ResourceType();
r.setName(isNotEmpty(this.name) ? this.name : DEFAULT_NAME);
r.setLocation(this.schemaLocation.toASCIIString());
r.setLocation(this.schemaLocation != null ? this.schemaLocation.toASCIIString() : "manuelly configured");
o.getResource().add(r);
return o;
}

View file

@ -81,7 +81,14 @@ public class RelativeUriResolver implements URIResolver {
}
private boolean isUnderBaseUri(final URI resolved) {
final String base = this.baseUri.toASCIIString().replaceAll("file:/+", "");
return isUnderBaseUri(resolved, this.baseUri);
}
private static boolean isUnderBaseUri(final URI resolved, final URI baseUri) {
if (resolved == null || baseUri == null) {
return false;
}
final String base = baseUri.toASCIIString().replaceAll("file:/+", "");
final String r = resolved.toASCIIString().replaceAll("file:/+", "");
return r.startsWith(base);
}