ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: AW: Null pointer Exception..
Date Mon, 14 Feb 2005 09:47:06 GMT
Yes, this is a bug.
It has happened before where a directory exists but the
user does not have read-access (or execute-access ?) on the directory.
http://marc.theaimsgroup.com/?l=ant-user&m=109819243121238&w=2
I forgot to make the neccessary change. - it probally needs a warning
but it is too early to use a project - so stderr should be used.

Peter


Jan.Materne@rzf.fin-nrw.de wrote:

>Mmh, could be a bug.
>In revision 1.1.5 [1] I found
>
>0230: public static URL[] getLocationURLs(File location, final String[]
>extensions)
>...
>0251:         File[] matches = location.listFiles(
>0252:             new FilenameFilter() {
>0253:                 public boolean accept(File dir, String name) {
>0254:                     for (int i = 0; i < extensions.length; ++i) {
>0255:                         if
>(name.toLowerCase().endsWith(extensions[i])) {
>0256:                             return true;
>0257:                         }
>0258:                     }
>0259:                     return false;
>0260:                 }
>0261:             });
>0262: 
>0263:         urls = new URL[matches.length];
>
>and the javadoc for File.listFiles [2] sais "Returns null if this abstract
>pathname does not denote a directory, or 
>if an I/O error occurs." Therefore "matches.length" would produce the NPE.
>
>For Matt, because he loves ?:-notations :-)
>  urls = (matches!=null) ? new URL[matches.length] : new URL[0];
>
>
>Just the first quick view ...
>
>
>
>Jan
>
>[1]
>http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/src/main/org/apache/tools/a
>nt/launch/Locator.java?rev=1.15
>[2]
>http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#listFiles(java.io.
>FileFilter)
>
>
>
>
>  
>
>>-----Urspr√ľngliche Nachricht-----
>>Von: Akash Jain (akasjain) [mailto:akasjain@cisco.com]
>>Gesendet am: Montag, 14. Februar 2005 09:59
>>An: user@ant.apache.org
>>Betreff: Null pointer Exception..
>>
>>hi ant gurus..
>>i'm having some problem in running ANT..
>>seems 2 b some problem with the installation..
>>everytime i run Ant it gives 
>> 
>>java.lang.NullPointerException
>>        at
>>org.apache.tools.ant.launch.Locator.getLocationURLs(Locator.java:262)
>> 
>>        at
>>org.apache.tools.ant.launch.Locator.getLocationURLs(Locator.java:212)
>> 
>>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:128)
>>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
>> 
>>kindly giv n e inputs for this
>> 
>> 
>> Regards
>> Akash jain
>> 
>>
>>    
>>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message