You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by kk...@apache.org on 2005/02/01 01:27:01 UTC
svn commit: r149330 -
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java
Author: kkrouse
Date: Mon Jan 31 16:26:58 2005
New Revision: 149330
URL: http://svn.apache.org/viewcvs?view=rev&rev=149330
Log:
catch bad URIs in import/include schemaLocation
Modified:
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java?view=diff&r1=149329&r2=149330
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java Mon Jan 31 16:26:58 2005
@@ -197,8 +197,9 @@
//workaround for Sun bug # 4723726
private static URI resolve(URI base, String child)
+ throws URISyntaxException
{
- URI childUri = URI.create(child);
+ URI childUri = new URI(child);
URI ruri = base.resolve(childUri);
// if the child fragment is relative (which we'll assume is the case
@@ -327,11 +328,20 @@
if (locationURL == null)
return null;
+ StscState state = StscState.get();
+
// First resolve relative URLs with respect to base URL for doc
URI baseURI = parseURI(baseURLForDoc(referencedBy));
- String absoluteURL = baseURI == null ? locationURL : resolve(baseURI, locationURL).toString();
-
- StscState state = StscState.get();
+ String absoluteURL = null;
+ try
+ {
+ absoluteURL = baseURI == null ? locationURL : resolve(baseURI, locationURL).toString();
+ }
+ catch (URISyntaxException e)
+ {
+ state.error("Could not find resource - invalid location URL: " + e.getMessage(), XmlErrorCodes.CANNOT_FIND_RESOURCE, referencedBy);
+ return null;
+ }
// probe 0: this url is already processed, from a previous compile
if (state.isFileProcessed(absoluteURL))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org