Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C5EA5B7D1 for ; Mon, 16 Jan 2012 21:00:03 +0000 (UTC) Received: (qmail 58738 invoked by uid 500); 16 Jan 2012 21:00:03 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 58522 invoked by uid 500); 16 Jan 2012 21:00:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 58479 invoked by uid 99); 16 Jan 2012 21:00:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 21:00:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 21:00:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2F729150205 for ; Mon, 16 Jan 2012 20:59:41 +0000 (UTC) Date: Mon, 16 Jan 2012 20:59:41 +0000 (UTC) From: "Gary D. Gregory (Commented) (JIRA)" To: issues@commons.apache.org Message-ID: <914611284.45957.1326747581195.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1271609883.43904.1326701678500.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (VFS-399) Custom VFSes over ZIP crashes with Null pointer Exception MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/VFS-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187180#comment-13187180 ] Gary D. Gregory commented on VFS-399: ------------------------------------- The test {{org.apache.commons.vfs2.provider.zip.test.NestedZipTestCase}} works in trunk. I am guessing it worked when 2.0 was released. Can you provide a test case patch that shows the problem? Perhaps using other VFS file providers? Thank you. > 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 > Priority: Blocker > 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 is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira