tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon colston <si...@lexues.co.jp>
Subject Re: Strange NullPointerException Error in t4.0b7
Date Tue, 04 Sep 2001 13:53:13 GMT
Paul,

You can create a File object pointing at anything - so directory will never be null.
files is null because:
1. directory doesn't exist, or
2. there are no files in directory, or
3. you don't have access to the files in directory

What does directory.getAbsolutePath() give you?  

Relative paths are not very easy to use and are not very portable.


On Tue, 04 Sep 2001 12:03:45 
"Paul Kofon" <pkofon@hotmail.com> wrote:

PK> Hi All,
PK> I recently downloaded and installed Tomcat 4.0 b7. I found it to be quite 
PK> responsive and remarkably faster than it's predecessors. However, my joy was 
PK> short-lived when I found out an application which I had written and 
PK> extensively tested under Tomcat 3.2.2. was not working in the T4.0 b7 
PK> environment - I kept getting a NullPointerException error. I snooped around 
PK> a bit and found out that the following piece of code was the culprit:
PK> 
PK> File directory = new File("../webapps/humantrack/forms");
PK> File files[] = directory.listFiles();
PK> 
PK> Now, here's the strange thing: "directory" isn't null but the array, 
PK> files[], is! This code works without change in T3.2.2 as files[] doesn't 
PK> return a null value. What's wrong?
PK> 
PK> Regards,
PK> 
PK> Paul
PK> 
PK> 
PK> 
PK> _________________________________________________________________
PK> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
PK> 
PK> 


--
simon colston
simon@lexues.co.jp

Mime
View raw message