SWS-647 - PayloadValidatingInterceptor throws IllegalArgumentException when passed a schema collection

This commit is contained in:
Arjen Poutsma
2012-01-25 09:35:25 +00:00
parent 0f277d4e4a
commit e2e18094f3

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -113,7 +113,9 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
this.inline = inline;
}
/** Sets the WS-Commons validation event handler to use while parsing schemas. */
/**
* Sets the WS-Commons validation event handler to use while parsing schemas.
*/
public void setValidationEventHandler(ValidationEventHandler validationEventHandler) {
this.validationEventHandler = validationEventHandler;
}
@@ -175,7 +177,10 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
Resource[] resources = new Resource[xmlSchemas.size()];
for (int i = xmlSchemas.size() - 1; i >= 0; i--) {
XmlSchema xmlSchema = xmlSchemas.get(i);
resources[i] = new UrlResource(xmlSchema.getSourceURI());
String sourceUri = xmlSchema.getSourceURI();
if (StringUtils.hasLength(sourceUri)) {
resources[i] = new UrlResource(sourceUri);
}
}
return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML);
}