this is baffling me.. for one thing I never get this error when viewing my photo site from home, only when on another machine..


this always prints in logs in conjunction with a nullpointer...

for nullpointer it gives line in jsp servlets, it's always this line:

if (imgsList.length == 0) {

what I do is I use to count how many images are in 'images' dir (diff no. of images in 'images' dir for every page in my photosite).. is it possible that when that code runs sometimes the app hasn't quite loaded and read that 'images' dir yet? is there an equiv in JSP to jQuery's $(document).ready or something so that I'm sure app has fully loaded before it reads how many images are in 'images' dir? again, this error occurs intermittently, and never in my machine at home.. I only find out the hard way whenever am looking @ my site in an internet cafe or something... (even at work I never get it.. even if I clear cache...)

this is code I run to count images in 'images' dir:

FPath = "/chroot/home/............../apache-tomcat-5.5.25/webapps/" + sContext + "/" + sCurrSection + "/" + sCurrPage + "/images/";
(I do a conditional here with getHeader("host") to detect whether I'm in Tomcat localhost or at my website...) then:

File dir = new File(FPath);
String[] imgsList;
imgsList = dir.list();
if (imgsList.length == 0) { // etc...

I have been using this code unchanged in my app for about three years.. don't get why it's throwing this weird error now..

thank you..