commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Eckenfels" <>
Subject [VFS] DelegateFileObject does not prevent NullPointerExceptions
Date Fri, 13 Sep 2013 19:02:29 GMT

while working with VirtualFileSystemProvider (which seems to be the only  
user of DelegateFileObject) I noticed that if a delegated file is created  
without a backing file some methods (like doCreateFolder()) do not  
properly catch this condition. It produces a rather ugly NPE.

Some methods act sane on file == null, but a lot of the delegating methods  
look like:

     protected void doCreateFolder() throws Exception
         ignoreEvent = true;
             ignoreEvent = false;

I propose to change this like:


with a FileSystemException "not attached".

Alternatively one could set a default placeholder file (instead of null),  
which can then do some different handlings. But that requires to change  
the places where == null checks are today.

Instead of trying an exceptio we can also try to have a default behaviour  
in more of the places. (For example returning a empty read only content  
dummy). What do you think? Want me to open a Jira?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message