You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/11/05 12:32:37 UTC
cvs commit: xml-cocoon2/src/org/apache/cocoon/generation HTMLGenerator.java ScriptGenerator.java
cziegeler 01/11/05 03:32:37
Modified: src/org/apache/cocoon/generation Tag: cocoon_20_branch
HTMLGenerator.java ScriptGenerator.java
Log:
More NPE fixes
Revision Changes Path
No revision
No revision
1.4.2.12 +9 -7 xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
Index: HTMLGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
retrieving revision 1.4.2.11
retrieving revision 1.4.2.12
diff -u -r1.4.2.11 -r1.4.2.12
--- HTMLGenerator.java 2001/10/25 19:31:25 1.4.2.11
+++ HTMLGenerator.java 2001/11/05 11:32:37 1.4.2.12
@@ -39,7 +39,7 @@
/**
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.4.2.11 $ $Date: 2001/10/25 19:31:25 $
+ * @version CVS $Revision: 1.4.2.12 $ $Date: 2001/11/05 11:32:37 $
*/
public class HTMLGenerator extends ComposerGenerator implements Cacheable, Recyclable {
@@ -55,8 +55,10 @@
*/
public void recycle() {
super.recycle();
- this.inputSource.recycle();
- this.inputSource = null;
+ if (this.inputSource != null) {
+ this.inputSource.recycle();
+ this.inputSource = null;
+ }
this.xpath = null;
}
@@ -67,7 +69,7 @@
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
-
+
Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
xpath = request.getParameter("xpath");
if(xpath == null)
@@ -83,10 +85,10 @@
String[] values = request.getParameterValues( name );
for (int i = 0; i < values.length; i++) {
- query.append( name ).append( "=" ).append( values[i] ).append( "&" );
+ query.append( name ).append( "=" ).append( values[i] ).append( "&" );
}
}
-
+
if (query.length() > 0) {
super.source = new StringBuffer(super.source).append("?").append(query.substring( 0, query.length() - 1 )).toString();
}
@@ -147,7 +149,7 @@
NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath);
Node n;
while ((n = nl.nextNode())!= null)
- {
+ {
SAXResult result = new SAXResult(this.contentHandler);
result.setLexicalHandler(this.lexicalHandler);
serializer.transform(new DOMSource(n), result);
1.7.2.7 +5 -3 xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java
Index: ScriptGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -r1.7.2.6 -r1.7.2.7
--- ScriptGenerator.java 2001/10/11 08:56:12 1.7.2.6
+++ ScriptGenerator.java 2001/11/05 11:32:37 1.7.2.7
@@ -45,7 +45,7 @@
* </pre>
*
* @author <a href="mailto:jafoster@engmail.uwaterloo.ca">Jason Foster</a>
- * @version CVS $Revision: 1.7.2.6 $ $Date: 2001/10/11 08:56:12 $
+ * @version CVS $Revision: 1.7.2.7 $ $Date: 2001/11/05 11:32:37 $
*/
public class ScriptGenerator extends ComposerGenerator implements Configurable,
Recyclable {
@@ -101,8 +101,10 @@
public void recycle() {
super.recycle();
- this.inputSource.recycle();
- this.inputSource = null;
+ if (this.inputSource != null) {
+ this.inputSource.recycle();
+ this.inputSource = null;
+ }
}
public void generate() throws ProcessingException {
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org