src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/AbstractReferenceFinderImpl.java
Print this page
*** 23,55 ****
* questions.
*/
package com.sun.tools.internal.xjc.reader.internalizer;
- import java.io.IOException;
- import java.io.File;
- import java.net.URI;
- import java.net.URISyntaxException;
-
import com.sun.istack.internal.SAXParseException2;
-
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.XMLFilterImpl;
/**
* XMLFilter that finds references to other schema files from
* SAX events.
! *
* This implementation is a base implementation for typical case
* where we just need to look for a particular attribute which
* contains an URL to another schema file.
*
! * @author
! * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public abstract class AbstractReferenceFinderImpl extends XMLFilterImpl {
protected final DOMForest parent;
--- 23,53 ----
* questions.
*/
package com.sun.tools.internal.xjc.reader.internalizer;
import com.sun.istack.internal.SAXParseException2;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.XMLFilterImpl;
+ import java.io.File;
+ import java.io.IOException;
+ import java.net.URI;
+ import java.net.URISyntaxException;
+
/**
* XMLFilter that finds references to other schema files from
* SAX events.
! * <p/>
* This implementation is a base implementation for typical case
* where we just need to look for a particular attribute which
* contains an URL to another schema file.
*
! * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public abstract class AbstractReferenceFinderImpl extends XMLFilterImpl {
protected final DOMForest parent;
*** 59,74 ****
/**
* IF the given element contains a reference to an external resource,
* return its URL.
*
! * @param nsURI
! * Namespace URI of the current element
! * @param localName
! * Local name of the current element
! * @return
! * It's OK to return a relative URL.
*/
protected abstract String findExternalResource(String nsURI, String localName, Attributes atts);
@Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
--- 57,69 ----
/**
* IF the given element contains a reference to an external resource,
* return its URL.
*
! * @param nsURI Namespace URI of the current element
! * @param localName Local name of the current element
! * @return It's OK to return a relative URL.
*/
protected abstract String findExternalResource(String nsURI, String localName, Attributes atts);
@Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
*** 81,90 ****
--- 76,89 ----
}
try {
// absolutize URL.
String lsi = locator.getSystemId();
String ref;
+ URI relRefURI = new URI(relativeRef);
+ if (relRefURI.isAbsolute())
+ ref = relativeRef;
+ else {
if (lsi.startsWith("jar:")) {
int bangIdx = lsi.indexOf('!');
if (bangIdx > 0) {
ref = lsi.substring(0, bangIdx + 1)
+ new URI(lsi.substring(bangIdx + 1)).resolve(new URI(relativeRef)).toString();
*** 92,101 ****
--- 91,101 ----
ref = relativeRef;
}
} else {
ref = new URI(lsi).resolve(new URI(relativeRef)).toString();
}
+ }
// then parse this schema as well,
// but don't mark this document as a root.
if (parent != null) { // this is there to allow easier testing
parent.parse(ref, false);
*** 119,131 ****
fatalError(spe);
throw spe;
}
}
private Locator locator;
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
this.locator = locator;
}
! };
--- 119,132 ----
fatalError(spe);
throw spe;
}
}
+
private Locator locator;
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
this.locator = locator;
}
! }