|
1 | 1 | /* |
2 | | - * Copyright 2005-2010 the original author or authors. |
| 2 | + * Copyright 2005-2012 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | 7 | * |
8 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 | * |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
@@ -113,7 +113,9 @@ public void setInline(boolean inline) { |
113 | 113 | this.inline = inline; |
114 | 114 | } |
115 | 115 |
|
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 | + */ |
117 | 119 | public void setValidationEventHandler(ValidationEventHandler validationEventHandler) { |
118 | 120 | this.validationEventHandler = validationEventHandler; |
119 | 121 | } |
@@ -175,7 +177,10 @@ public XmlValidator createValidator() throws IOException { |
175 | 177 | Resource[] resources = new Resource[xmlSchemas.size()]; |
176 | 178 | for (int i = xmlSchemas.size() - 1; i >= 0; i--) { |
177 | 179 | 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 | + } |
179 | 184 | } |
180 | 185 | return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); |
181 | 186 | } |
|
0 commit comments