SWS-1036 - Make SimpleXsdSchema's toString more resilient
Backported to 2.x.
This commit is contained in:
@@ -91,6 +91,9 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
|
||||
|
||||
@Override
|
||||
public String getTargetNamespace() {
|
||||
|
||||
Assert.notNull(schemaElement, "schemaElement must not be null! Did you run afterPropertiesSet() or register this as a Spring bean?");
|
||||
|
||||
return schemaElement.getAttribute("targetNamespace");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.xml.xsd;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
|
||||
@@ -27,4 +29,11 @@ public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
|
||||
return schema;
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testBareXsdSchema() {
|
||||
|
||||
SimpleXsdSchema schema = new SimpleXsdSchema();
|
||||
schema.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user