Author: davsclaus Date: Sun Mar 18 11:27:07 2012 New Revision: 1302113 URL: http://svn.apache.org/viewvc?rev=1302113&view=rev Log: CAMEL-5063: Validator component now has better error reporing if cannot resolve resource from schema.
Added: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java - copied unchanged from r1302111, camel/trunk/camel-core/src/test/java/org/apache/camel/component/validator/ValidatorIllegalImportTest.java camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/BroadcastMonitor.xsd - copied unchanged from r1302111, camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/BroadcastMonitor.xsd camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/BroadcastMonitorFixed.xsd - copied unchanged from r1302111, camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/BroadcastMonitorFixed.xsd Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/health.xsd camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/person.xsd Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1302111 Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java?rev=1302113&r1=1302112&r2=1302113&view=diff ============================================================================== --- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java (original) +++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java Sun Mar 18 11:27:07 2012 @@ -45,7 +45,12 @@ public class DefaultLSResourceResolver i @Override public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { - return new DefaultLSInput(baseURI, namespaceURI, publicId, systemId, type); + // systemId should be mandatory + if (systemId == null) { + throw new IllegalArgumentException(String.format("Resource: %s refers an invalid resource without SystemId." + + " Invalid resource has type: %s, namespaceURI: %s, publicId: %s, systemId: %s, baseURI: %s", resourceUri, type, namespaceURI, publicId, systemId, baseURI)); + } + return new DefaultLSInput(type, namespaceURI, publicId, systemId, baseURI); } private final class DefaultLSInput implements LSInput { @@ -63,7 +68,7 @@ public class DefaultLSResourceResolver i this.publicId = publicId; this.systemId = systemId; this.type = type; - + if (resourcePath != null) { uri = resourcePath + "/" + systemId; } else { Modified: camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/health.xsd URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/health.xsd?rev=1302113&r1=1302112&r2=1302113&view=diff ============================================================================== --- camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/health.xsd (original) +++ camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/health.xsd Sun Mar 18 11:27:07 2012 @@ -1,4 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" Modified: camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/person.xsd URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/person.xsd?rev=1302113&r1=1302112&r2=1302113&view=diff ============================================================================== --- camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/person.xsd (original) +++ camel/branches/camel-2.9.x/camel-core/src/test/resources/org/apache/camel/component/validator/person.xsd Sun Mar 18 11:27:07 2012 @@ -1,4 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"