File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
main/java/org/springframework/xml/xsd
test/java/org/springframework/xml/xsd Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 4343 *
4444 * @author Mark LaFond
4545 * @author Arjen Poutsma
46+ * @author Greg Turnquist
4647 * @since 1.5.0
4748 */
4849public class SimpleXsdSchema implements XsdSchema , InitializingBean {
@@ -91,6 +92,9 @@ public void setXsd(Resource xsdResource) {
9192
9293 @ Override
9394 public String getTargetNamespace () {
95+
96+ Assert .notNull (schemaElement , "schemaElement must not be null! Did you run afterPropertiesSet() or register this as a Spring bean?" );
97+
9498 return schemaElement .getAttribute ("targetNamespace" );
9599 }
96100
Original file line number Diff line number Diff line change 1616
1717package org .springframework .xml .xsd ;
1818
19+ import org .junit .Test ;
20+
1921import org .springframework .core .io .Resource ;
2022
2123public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
@@ -27,4 +29,11 @@ protected XsdSchema createSchema(Resource resource) throws Exception {
2729 return schema ;
2830 }
2931
32+ @ Test (expected = IllegalArgumentException .class )
33+ public void testBareXsdSchema () {
34+
35+ SimpleXsdSchema schema = new SimpleXsdSchema ();
36+ schema .toString ();
37+ }
38+
3039}
You can’t perform that action at this time.
0 commit comments