From: Alistair Y. <ali...@sm...> - 2005-07-14 09:22:14
|
I've found the probem. TemplateBuilderTask.iterateTemplates() doesn't set the language of =20 the templates. That's where the NPE is coming from. In BuildingServlet.doProcessing(), Template objects are used and =20 XmlTemplate is obtained indirectly at runtime but the ant task uses =20 XmlTemplate directly, thus bypassing the language initialisation. Adding this line to TemplateBuilderTask.iterateTemplates(): template.setLanguage("en"); fixes the problem At runtime this is called via Template.setProcessorLanguage() "en" is a hard code though. Alexis, what's your opinion on adding a =20 language option to build.properties and setting it to "en" by =20 default. If you want to compile bod in another language you change =20 the language setting in build.properties? XmlTemplate doesn't need patched, just =20 TemplateBuilderTask.iterateTemplates() Alistair On 13 Jul 2005, at 21:52, Alistair Young wrote: >> [template-compiler] Error(s) found with >> "style_default/default/applettop.html": >> [template-compiler] Technical error trying to insert iteractive item. >> > got that without the patch. With the patch I couldn't get that far =20 > as it > barfed on style_0/recycler/main.html instead. Without the patch, =20 > removing > the localised literal fixed the problem. However, it shouldn't have =20= > been > localised in the first place. This is what I meant by #define. I =20 > should > have said enumeration. The template is calling Facility and passing =20= > what > is essentially an enum to get the Facility method to do something. > > >>> I'm getting a NullPointerException for style_0/recycler/main.html =20= >>> when >>> >> Is this with my patch applied? >> > yes > > >> I don't see the NPE. >> > sorry, I sort of hacked my way into it - XmlTemplate.compileCall() =20 > catches > a RuntimeException, which turns out to be the NPE > > >> So you hardcode the resource >> properties in the .java file that the compiler produces? >> > yes. There was a debate ages ago whether to substitute a <localise> > element with the actual text or write code into the template class to > dynamically call the Localiser. We choose the dynamic method as =20 > that lets > you update the properties file without recompiling the template. > > >> Although if I set the build not to compile templates I was getting =20= >> the >> same error when Bodington was deployed localy. >> > interesting. Ant has deployed it ok here. It's localised as we had > problems with the Localiser and whitespace, which we've fixed. The > literals are being localised ok here. Ant doesn't have your patch =20 > though. > > >> Are you on Jabber or IRC? >> > nope! never got that far! playing with the cat just now :) > > Maybe I'll have more ideas by the morning. > > Thanks for looking into it. > > Alistair > > > --=20 > Alistair Young > Senior Software Engineer > UHI@Sabhal M=F2r Ostaig > Isle of Skye > Scotland > > >> Alistair Young wrote: >> >>> Thanks Mathew, >>> >>> I copied this into my tree with no effect. I'm not convinced the =20 >>> problem >>> lies here. Template compilation used to work. I think it was =20 >>> using the >>> bat >>> file before. It's using an ant task now. >>> >> >> Ok. But with an up to date checkout of bodington HEAD (without my =20 >> patch) >> do you see this error when attempting to compile the templates =20 >> through >> the ant task? >> >> [template-compiler] Compiling 459 templates to >> /home/buckett/workspace/bodington/build/bodington/WEB-INF/=20 >> template_classes >> [template-compiler] Error(s) found with >> "style_default/default/applettop.html": >> [template-compiler] Technical error trying to insert iteractive item. >> >> >>> I'm getting a NullPointerException for style_0/recycler/main.html =20= >>> when >>> it >>> XmlTemplate tries to compile: >>> <literal type=3D"String"></literal> >>> There isn't any localisation in this template. >>> >> >> Is this with my patch applied? >> >> >>> The lack of a string causes the exception. Which leads me to =20 >>> think that: >>> <literal type=3D"String"><localise id=3D"enter.website" /></literal> >>> in style_default/default/login_anon.html >>> has the same problem - I verified it has a NullPointerException too. >>> >> >> I don't see the NPE. >> >> >>> XmlTemplate.getCharacterData() replaces the <localise> element in a >>> <literal> element with the text that the Localiser returns. >>> >> >> Ok thanks, I hadn't spotted that, thanks. So you hardcode the =20 >> resource >> properties in the .java file that the compiler produces? >> >> >>> This seems to point to the Localiser not being either available =20 >>> or not >>> finding the properties file when XmlTemplate is invoked from the ant >>> task. >>> >> >> Although if I set the build not to compile templates I was getting =20= >> the >> same error when Bodington was deployed localy. >> >> >>> That wouldn't explain why <literal type=3D"String"></literal> causes = a >>> NullPointerException now. It didn't before. >>> >> >> Indeed. >> >> >>> any ideas? >>> >> >> I'm looking..... Are you on Jabber or IRC? >> >> -- >> +--Matthew Buckett-----------------------------------------+ >> | VLE Developer, Learning Technologies Group | >> | Tel: +44 (0) 1865 283660 http://www.oucs.ox.ac.uk/ | >> +------------Computing Services, University of Oxford------+ >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by the 'Do More With Dual!' webinar >> happening >> July 14 at 8am PDT/11am EDT. We invite you to explore the latest =20 >> in dual >> core and dual graphics technology at this free one hour event =20 >> hosted by >> HP, >> AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar >> _______________________________________________ >> Bodington-developers mailing list >> Bod...@li... >> https://lists.sourceforge.net/lists/listinfo/bodington-developers >> >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar =20 > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in =20= > dual > core and dual graphics technology at this free one hour event =20 > hosted by HP, > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > Bodington-developers mailing list > Bod...@li... > https://lists.sourceforge.net/lists/listinfo/bodington-developers > |