cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.0/src/java/org/apache/cocoon/transformation SQLTransformer.java
Date Wed, 11 Jun 2003 00:28:00 GMT
joerg       2003/06/10 17:28:00

  Modified:    src/java/org/apache/cocoon/transformation
                        SQLTransformer.java
  Log:
  fixed bug 14977: NPE in serializeData()
  
  Revision  Changes    Path
  1.5       +13 -12    cocoon-2.0/src/java/org/apache/cocoon/transformation/SQLTransformer.java
  
  Index: SQLTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/transformation/SQLTransformer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SQLTransformer.java	13 Mar 2003 15:33:23 -0000	1.4
  +++ SQLTransformer.java	11 Jun 2003 00:28:00 -0000	1.5
  @@ -1182,32 +1182,33 @@
               query_parts.addElement( object );
           }
   
  -        protected void serializeData(ComponentManager manager,
  -                                     String           value)
  -        throws SQLException, SAXException {
  +        protected void serializeData(ComponentManager manager, String value)
  +                throws SQLException, SAXException {
               if (value != null) {
                   value = value.trim();
                   // Could this be XML ?
                   if (value.length() > 0 && value.charAt(0) == '<') {
                       try {
  -                        if (transformer.parser != null) {
  +                        if (transformer.parser == null) {
                               transformer.parser = (SAXParser)manager.lookup(SAXParser.ROLE);
                           }
  -                        if (transformer.compiler != null) {
  -                            compiler = (XMLSerializer)manager.lookup(XMLSerializer.ROLE);
  +                        if (transformer.compiler == null) {
  +                            transformer.compiler = (XMLSerializer)manager.lookup(XMLSerializer.ROLE);
                           }
  -                        if (transformer.interpreter != null) {
  -                            interpreter = (XMLDeserializer)manager.lookup(XMLDeserializer.ROLE);
  +                        if (transformer.interpreter == null) {
  +                            transformer.interpreter = (XMLDeserializer)manager.lookup(XMLDeserializer.ROLE);
                           }
  -                        parser.parse(new InputSource(new StringReader("<root>"+value+"</root>")),
compiler);
  +                        transformer.parser.parse(new InputSource(new StringReader("<root>"
+ value + "</root>")),
  +                                                 transformer.compiler);
   
                           IncludeXMLConsumer filter = new IncludeXMLConsumer(transformer,
transformer);
                           filter.setIgnoreRootElement(true);
   
  -                        interpreter.setConsumer(filter);
  +                        transformer.interpreter.setConsumer(filter);
   
  -                        interpreter.deserialize(compiler.getSAXFragment());
  +                        transformer.interpreter.deserialize(transformer.compiler.getSAXFragment());
                       } catch (Exception local) {
  +                        // FIXME: bad coding "catch(Exception)"
                           // if an exception occured the data was not xml
                           transformer.data(value);
                       }
  
  
  

Mime
View raw message