sylvain 2002/09/11 05:44:10 Modified: . changes.xml src/java/org/apache/cocoon/acting SessionPropagatorAction.java src/java/org/apache/cocoon/components/language/generator ProgramGeneratorImpl.java src/java/org/apache/cocoon/components/language/markup/xsp/java xsp.xsl src/java/org/apache/cocoon/generation AbstractServerPage.java Log: Fix a nasty bug in XSP recompilation : static fields were used for dependencies, meaning their value was shared by *all* XSP pages. Revision Changes Path 1.245 +5 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.244 retrieving revision 1.245 diff -u -r1.244 -r1.245 --- changes.xml 9 Sep 2002 17:53:16 -0000 1.244 +++ changes.xml 11 Sep 2002 12:44:09 -0000 1.245 @@ -40,6 +40,10 @@ </devs> <release version="@version@" date="@date@"> + <action dev="SW" type="fix"> + AbstractServerPages used static fields for dependency tracking, which caused + either non-modified XSPs to be recompiled, or modified XSPs not to be recompiled. + </action> <action dev="MC" type="add" fixes-bug="12304"> Added AxisRPCReader to scratchpad. This reader essentially allows you to serve SOAP requests from your Cocoon application. Sample webapp with 1.9 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/acting/SessionPropagatorAction.java Index: SessionPropagatorAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/SessionPropagatorAction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SessionPropagatorAction.java 11 Sep 2002 08:26:44 -0000 1.8 +++ SessionPropagatorAction.java 11 Sep 2002 12:44:09 -0000 1.9 @@ -84,7 +84,7 @@ public class SessionPropagatorAction extends AbstractConfigurableAction implements ThreadSafe { - private static Object[] defaults = {}; + private Object[] defaults = {}; public void configure(Configuration conf) throws ConfigurationException { if (conf != null) { 1.21 +4 -2 xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java Index: ProgramGeneratorImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ProgramGeneratorImpl.java 31 Jul 2002 13:13:23 -0000 1.20 +++ ProgramGeneratorImpl.java 11 Sep 2002 12:44:09 -0000 1.21 @@ -292,7 +292,9 @@ if (this.autoReload) { long sourceLastModified = source.getLastModified(); // has XSP changed? - if (programInstance.modifiedSince(sourceLastModified) || sourceLastModified == 0) { + // Note : lastModified can be 0 if source is dynamically generated. + // In that case, let the program instance decide if it is modified or not. + if (programInstance.modifiedSince(sourceLastModified)) { if (getLogger().isDebugEnabled()) { getLogger().debug("ReCreating serverpage for [" + String.valueOf(id) + "]"); } 1.12 +9 -5 xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl Index: xsp.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- xsp.xsl 2 Aug 2002 02:18:26 -0000 1.11 +++ xsp.xsl 11 Sep 2002 12:44:09 -0000 1.12 @@ -133,13 +133,17 @@ */ public class <xsl:value-of select="@file-name"/> extends XSPGenerator { - static { - dateCreated = <xsl:value-of select="@creation-date"/>L; - dependencies = new File[] { + // Files this XSP depends on + private static File[] _dependentFiles = new File[] { <xsl:for-each select="//xsp:dependency"> new File("<xsl:value-of select="translate(., '\','/')"/>"), </xsl:for-each> }; + + // Initialize attributes used by modifiedSince() (see AbstractServerPage) + { + this.dateCreated = <xsl:value-of select="@creation-date"/>L; + this.dependencies = _dependentFiles; } /* Built-in parameters available for use */ 1.10 +7 -7 xml-cocoon2/src/java/org/apache/cocoon/generation/AbstractServerPage.java Index: AbstractServerPage.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/AbstractServerPage.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- AbstractServerPage.java 8 Aug 2002 07:47:36 -0000 1.9 +++ AbstractServerPage.java 11 Sep 2002 12:44:09 -0000 1.10 @@ -77,14 +77,14 @@ public abstract class AbstractServerPage extends ServletGenerator implements CompiledComponent, CacheableProcessingComponent, Recomposable { /** - * Code generators should produce a static + * Code generators should produce a constructor * block that initializes the generator's * creation date and file dependency list. * Example: * - * static { - * dateCreated = 958058788948L; - * dependencies = new File[] { + * { + * this.dateCreated = 958058788948L; + * this.dependencies = new File[] { * new File("source.xml"), * }; * } @@ -92,9 +92,9 @@ */ /** The creation date */ - protected static long dateCreated = -1L; + protected long dateCreated = -1L; /** The dependency file list */ - protected static File[] dependencies = null; + protected File[] dependencies = null; /** * Recompose with the actual <code>ComponentManager</code> that should
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]