So far it has always been alphabetic, but point taken. Still, if the order of initialization is pretty much undefined - is there a reliable way to specify page properties that depend one on another?
-- Alex -----Original Message----- From: Patrick Casey [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 10:45 AM To: 'Tapestry users' Subject: RE: Tapestry 3.0.3 - property initialization sequence I've got $0.25 that says it's probably some variable on a hashmap internally, so I wouldn't count on it always being alphabetic, although you could pretty much assume it won't happen in the same order they're on the page :). --- Pat > -----Original Message----- > From: Savitsky, Alex [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 11, 2005 7:33 AM > To: '[email protected]' > Subject: Tapestry 3.0.3 - property initialization sequence > > Hi, > > Found a funny quirk in the way page properties are initialized, that > can possibly lead to exceptions: > > Test.page: > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE page-specification > PUBLIC "-//Apache Software Foundation//Tapestry Specification > 3.0//EN" > "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd > <http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd> "> > <page-specification class="org.apache.tapestry.html.BasePage"> > <property-specification name="p2" > type="java.lang.Integer">1</property-specification> > <property-specification name="p1" > type="java.lang.Integer">p2.intValue() + 1</property-specification> > </page-specification> > > Load the page, get an NPE. Reason? I went in with a debugger to check, > and it looks like the properties are initialized in alphabetic order > (so that "p1" is initialized BEFORE "p2"). Swap the variable names (so > that "p2" depend on "p1", instead of the other way around), and the > page loads fine. > > Am I missing something, or it is really being done that way? In this > case, is it really the best way to handle that? Wouldn't a some sort > of endless loop be better, so that initialization of "dependent" > properties could be deferred until their "parent" properties are > initialized? > > I haven't tried Tapestry 4 yet, does anyone know, was that... m-m-m... > "feature" fixed there? > > Regards, > > Alex Savitsky --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
