Skip to content

Commit e2e1809

Browse files
committed
SWS-647 - PayloadValidatingInterceptor throws IllegalArgumentException when passed a schema collection
1 parent 0f277d4 commit e2e1809

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -113,7 +113,9 @@ public void setInline(boolean inline) {
113113
this.inline = inline;
114114
}
115115

116-
/** Sets the WS-Commons validation event handler to use while parsing schemas. */
116+
/**
117+
* Sets the WS-Commons validation event handler to use while parsing schemas.
118+
*/
117119
public void setValidationEventHandler(ValidationEventHandler validationEventHandler) {
118120
this.validationEventHandler = validationEventHandler;
119121
}
@@ -175,7 +177,10 @@ public XmlValidator createValidator() throws IOException {
175177
Resource[] resources = new Resource[xmlSchemas.size()];
176178
for (int i = xmlSchemas.size() - 1; i >= 0; i--) {
177179
XmlSchema xmlSchema = xmlSchemas.get(i);
178-
resources[i] = new UrlResource(xmlSchema.getSourceURI());
180+
String sourceUri = xmlSchema.getSourceURI();
181+
if (StringUtils.hasLength(sourceUri)) {
182+
resources[i] = new UrlResource(sourceUri);
183+
}
179184
}
180185
return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML);
181186
}

0 commit comments

Comments
 (0)