From e2e18094f35a4893845327fd2499eb2ed7588c6a Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 25 Jan 2012 09:35:25 +0000 Subject: [PATCH] SWS-647 - PayloadValidatingInterceptor throws IllegalArgumentException when passed a schema collection --- .../xml/xsd/commons/CommonsXsdSchemaCollection.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java b/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java index 9932fc7e..d1a96d15 100644 --- a/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java +++ b/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java @@ -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); }