Changeset 33631

Show
Ignore:
Timestamp:
07.11.2019 14:52:21 (7 days ago)
Author:
kjdon
Message:

added a bit more error reporting

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XMLTransformer.java

    r32491 r33631  
    241241            TransformErrorListener transformerErrorListener = (TransformErrorListener) this.t_factory.getErrorListener(); 
    242242            transformerErrorListener.setStylesheet(stylesheet); 
    243             Transformer transformer = this.t_factory.newTransformer(new DOMSource(stylesheet)); 
     243            DOMSource xsl_source = new DOMSource(stylesheet); 
     244            if (xsl_source == null) { 
     245              logger.error("couldn't load stylesheet into domsource"); 
     246              return  transformError("XMLTransformer.transform(Doc, Doc, HashMap, Doc) couldn't load stylesheet into DOMSource", null); 
     247            } 
     248            Transformer transformer = this.t_factory.newTransformer(xsl_source); 
    244249            //logger.info("XMLTransformer transformer is " + transformer); //done in ErrorListener 
    245  
     250            if (transformer == null) { // the above is never supposed to return null :-( 
     251               logger.error("couldn't create transformer"); 
     252               return  transformError("XMLTransformer.transform(Doc, Doc, HashMap, Doc) couldn't load stylesheet", null); 
     253             } 
    246254            if (parameters != null) 
    247255            { 
     
    559567    protected Node transformError(String heading, Exception e) 
    560568    { 
     569      if (e == null) { 
     570        return constructErrorXHTMLPage(heading); 
     571      } 
    561572        String message = heading + "\n" + e.getMessage(); 
    562573        logger.error(heading + ": " + e.getMessage());