Gold Plated Blog Posts
Whatev.
Thursday, August 9, 2007

Quirks with Tiles

I was helping one of our programmers working on a bug with Tiles today and thought I would mention this in case anyone else was stumped. The solution came from just a good guess and I'm still not sure why it worked.

We came across a strange happening in the code where the page would load correctly visually but when viewing the source within the browser, there was a huge section of HTML missing. On a hunch, I asked the PM to use Firefox's View Selection Source feature. Sure enough, most of the HTML for the page was being loaded after the header and footer. It was almost as though the body of the page was being loaded through AJAX, although there was absolutely no AJAX written into the page. Today I had one of our programmers try to figure out why and I ended up stumbling over the problem.

We're using Tiles in this application and the section of code that was missing from the page was a part that was being inserted using Tiles' "insert" tag. There were a few usages of insert on the page but only one of them was missing from the initial source. I noticed that the one that was missing had the flush attribute set to "true". I've looked at the documentation for Tiles and the definition of flush doesn't seem like it would indicate this would be a problem. Just to be sure, I had the programmer remove the attribute completely and it happened to solve the issue. I apparently don't know enough about Tiles to understand what happened here because I was under the impression that Tiles would build the whole page before sending a response to the browser. I would love to know what was going on.

Sometimes you get lucky. On the other hand, the more things you try, the more you get lucky. In a similar situation last week, Tomcat wasn't starting properly, it was taking up to 10 minutes and would sometimes fail a few hours later. Of all things, our logging level for Log4J was set too high. The thought had crossed my mind but it wasn't until I had sufficiently banged my head against the wall, after attacking the issue from every logical angle, that I tried lowering it. I knew it was way too high but how could log messages cause a 10 minute delay in what is supposed to be a 2 second process? Anyway, in strange situations it's usually best to eliminate all peculiarities- no matter how unrelated to the problem they might seem- to be sure you know how it's working.

The articles in this blog are authored by Cameron Hinkle, Software Engineer for Nike. The thoughts and opinions expressed are not shared by Nike or any of its affiliates.