Source redirectSource = null;
try {
redirectSource = this.resolveURI(newURL);
this.toSAX(redirectSource, ls);
} catch (SourceException se) {
throw new CascadingIOException("SourceException: " + se, se);
} catch (SAXException se) {
throw new CascadingIOException("SAXException: " + se, se);
} catch (ProcessingException pe) {
throw new CascadingIOException("ProcessingException: " + pe, pe);
} finally {
this.release( redirectSource );
}
} else {
Source redirectSource = null;
try {
redirectSource = this.resolveURI(newURL);
InputStream is = redirectSource.getInputStream();
byte[] buffer = new byte[8192];
int length = -1;
while ((length = is.read(buffer)) > -1) {
this.outputStream.write(buffer, 0, length);
}
} catch (SourceException se) {
throw new CascadingIOException("SourceException: " + se, se);
} finally {
this.release( redirectSource);
}
}
}