Ok I have properly read the documentation header (maybe I should have
done this first before posting to the group! :-)...
/**
* Called by the processor through [EMAIL PROTECTED] FOUserAgent} when it
encounters an
* uri in an external-graphic element.
* (see also [EMAIL PROTECTED] javax.xml.transform.URIResolver#resolve(String,
String)}
* This resolver will allow URLs without a scheme, i.e. it assumes
'file:' as
* the default scheme. It also allows relative URLs with scheme,
* e.g. file:../../abc.jpg which is not strictly RFC compliant as
long as the
* scheme is the same as the scheme of the base URL. If the base
URL is null
* a 'file:' URL referencing the current directory is used as the
base URL.
* If the method is successful it will return a Source of type
* [EMAIL PROTECTED] javax.xml.transform.stream.StreamSource} with its
SystemID set to
* the resolved URL used to open the underlying InputStream.
*
* @param href An href attribute, which may be relative or absolute.
* @param base The base URI against which the first argument will
be made
* absolute if the absolute URI is required.
* @return A [EMAIL PROTECTED] javax.xml.transform.Source} object, or null if
the href
* cannot be resolved.
* @throws javax.xml.transform.TransformerException Never thrown by
this implementation.
* @see javax.xml.transform.URIResolver#resolve(String, String)
*/
I understand this is done so that another reference to a
javax.xml.transform.URIResolver implementing class might be called upon
for resolving. It is the responsibility of the calling code to throw
exceptions.. I am tracing the code now in my test case to find out
where the exception is not being thrown.
Many thanks,
Adrian.
Adrian Cumiskey wrote:
I am new to the FOP code so please bear with me... but have a quick
question about the revolve method in FOURIResolver. It appears to catch
all exceptions, log errors, silently return null and doesn't seem to
ever throw a TransformerException.
public Source resolve(String href, String base)
throws javax.xml.transform.TransformerException {
.....
try {
URLConnection connection = absoluteURL.openConnection();
connection.setAllowUserInteraction(false);
connection.setDoInput(true);
updateURLConnection(connection, href);
connection.connect();
return new StreamSource(connection.getInputStream(), effURL);
} catch (FileNotFoundException fnfe) {
//Note: This is on "debug" level since the caller is
supposed to handle this
log.debug("File not found: " + effURL);
} catch (java.io.IOException ioe) {
log.error("Error with opening URL '" + href + "': " +
ioe.getMessage(), ioe);
}
return null;
}
Is this desired behaviour (especially if this method is being invoked
indirectly as part of a TestCase)?
Cheers,
Adrian.