[ 
https://issues.apache.org/jira/browse/VFS-399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bernd Eckenfels updated VFS-399:
--------------------------------

    Priority: Major  (was: Blocker)

> Custom VFSes over ZIP crashes with Null pointer Exception
> ---------------------------------------------------------
>
>                 Key: VFS-399
>                 URL: https://issues.apache.org/jira/browse/VFS-399
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Windows XP x64
> Oracle JDK 1.6.0.27
>            Reporter: Konstantin Kasatkin
>         Attachments: test.zip
>
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> When I implement any intermediate VFS provider and try to connect it to ZIP 
> VFS provider like jar:myprovider:///myurl/myclasses.jar I get Null Pointer 
> Exception due to wrong implementation of ZIP provider. Because it initializes 
> NULL zip entry and tries to get last modification time of this entry without 
> checking for null value.
> I suggest the solution for this issue in two steps.
> 1. For elimination of issue in class 
> org.apache.commons.vfs2.provider.zip.ZipFileObject.java in method 
> doGetLastModifiedTime() {color:red}line 149{color} 
> change code: [{color:red} return entry.getTime();{color}]
> to code [{color:red}return entry==null ? 0 : entry.getTime();{color}]
> 2. For correct passing of last modification tate from parent VFS to ZIP VFS 
> in class org.apache.commons.vfs2.provider.zip.ZipFileSystem.java method 
> init() {color:red}line 115{color}
> change code [{color:red}parent = createZipFileObject(parentName, 
> null);{color}]
> to code [{color:red}
> ZipEntry parentEntry = new 
> ZipEntry(getParentLayer().getFileSystem().getRoot().getName().getPath());
> parentEntry.setSize(0);
> try {
>      
> parentEntry.setTime(getParentLayer().getFileSystem().getRoot().getContent().getLastModifiedTime());
> } catch (Exception e) { }
> parent = createZipFileObject(parentName, entry);{color}
> ]



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to