|
From: <tr...@us...> - 2003-09-04 03:02:52
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv28411
Modified Files:
XslTransformPipelineStage.java
Log Message:
Additional xsl transform error checking for incorrectly named files
Index: XslTransformPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/XslTransformPipelineStage.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** XslTransformPipelineStage.java 5 Aug 2003 23:28:30 -0000 1.17
--- XslTransformPipelineStage.java 4 Sep 2003 03:02:48 -0000 1.18
***************
*** 174,197 ****
if (xslfile != null) {
URL url = ResourceLoader.getUrl(xslfile);
- String protocol = url.getProtocol().toLowerCase();
! if ("file".equals(protocol)) {
! transformer = getCachedFileTransformer(xslfile);
! } else {
! InputStream is;
! StreamSource xslSource;
! is = ResourceLoader.getResourceStream(xslfile);
! xslSource = new StreamSource(is);
! // Note that if we don't do this, relative URLs can not be resolved correctly!
! String urlStr = url.toString();
! xslSource.setSystemId(urlStr);
! TransformerFactory transFact = TransformerFactory.newInstance();
! transformer = transFact.newTransformer(xslSource);
}
- } else if (xslscript != null) {
- transformer = getCachedScriptTransformer(xslscript);
- } else {
- throw new PipelineException(I18n.get("core.stage.xslTransform.error"));
}
--- 174,200 ----
if (xslfile != null) {
URL url = ResourceLoader.getUrl(xslfile);
! if(url!=null) {
! String protocol = url.getProtocol().toLowerCase();
! if ("file".equals(protocol)) {
! transformer = getCachedFileTransformer(xslfile);
! } else {
! InputStream is;
! StreamSource xslSource;
! is = ResourceLoader.getResourceStream(xslfile);
! xslSource = new StreamSource(is);
!
! // Note that if we don't do this, relative URLs can not be resolved correctly!
! String urlStr = url.toString();
! xslSource.setSystemId(urlStr);
! TransformerFactory transFact = TransformerFactory.newInstance();
! transformer = transFact.newTransformer(xslSource);
! }
! } else if (xslscript != null) {
! transformer = getCachedScriptTransformer(xslscript);
! } else {
! throw new PipelineException(I18n.get("core.stage.xslTransform.error"));
}
}
|