Return-Path: Delivered-To: apmail-myfaces-commits-archive@www.apache.org Received: (qmail 76176 invoked from network); 6 Oct 2008 23:38:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2008 23:38:43 -0000 Received: (qmail 44336 invoked by uid 500); 6 Oct 2008 23:38:42 -0000 Delivered-To: apmail-myfaces-commits-archive@myfaces.apache.org Received: (qmail 44198 invoked by uid 500); 6 Oct 2008 23:38:42 -0000 Mailing-List: contact commits-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list commits@myfaces.apache.org Received: (qmail 44189 invoked by uid 99); 6 Oct 2008 23:38:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 16:38:42 -0700 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_SECURITYSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 23:37:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 77D72238887A; Mon, 6 Oct 2008 16:37:52 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r702304 - /myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java Date: Mon, 06 Oct 2008 23:37:52 -0000 To: commits@myfaces.apache.org From: lu4242@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081006233752.77D72238887A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lu4242 Date: Mon Oct 6 16:37:51 2008 New Revision: 702304 URL: http://svn.apache.org/viewvc?rev=702304&view=rev Log: enhance jar opening for getResourceVersion Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java?rev=702304&r1=702303&r2=702304&view=diff ============================================================================== --- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java (original) +++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java Mon Oct 6 16:37:51 2008 @@ -298,50 +298,71 @@ if (url != null) { JarURLConnection conn = (JarURLConnection)url.openConnection(); + // See DIGESTER-29 for related problem + conn.setUseCaches(false); - if (conn.getJarEntry().isDirectory()) + try { - // Unfortunately, we have to scan all entry files - JarFile file = conn.getJarFile(); - for (Enumeration en = file.entries(); en.hasMoreElements();) + if (conn.getJarEntry().isDirectory()) { - JarEntry entry = en.nextElement(); - String entryName = entry.getName(); - - if (entryName.startsWith(path + '/')) + // Unfortunately, we have to scan all entry files + JarFile file = conn.getJarFile(); + for (Enumeration en = file.entries(); en.hasMoreElements();) { - if (entryName.length() == path.length() + 1) - { - // the same string, just skip it - continue; - } - - if (entryName.charAt(entryName.length() - 1) != '/') - { - // Skip files - continue; - } - - entryName = entryName.substring(path.length() + 1, entryName.length() - 1); - - if (entryName.indexOf('/') >= 0) - { - // Inner Directory - continue; - } - - String version = entryName; - if (resourceVersion == null) - { - resourceVersion = version; - } - else if (getVersionComparator().compare(resourceVersion, version) < 0) + JarEntry entry = en.nextElement(); + String entryName = entry.getName(); + + if (entryName.startsWith(path + '/')) { - resourceVersion = version; + if (entryName.length() == path.length() + 1) + { + // the same string, just skip it + continue; + } + + if (entryName.charAt(entryName.length() - 1) != '/') + { + // Skip files + continue; + } + + entryName = entryName.substring(path.length() + 1, entryName.length() - 1); + + if (entryName.indexOf('/') >= 0) + { + // Inner Directory + continue; + } + + String version = entryName; + if (resourceVersion == null) + { + resourceVersion = version; + } + else if (getVersionComparator().compare(resourceVersion, version) < 0) + { + resourceVersion = version; + } } } } } + finally + { + //See TRINIDAD-73 + //just close the input stream again if + //by inspecting the entries the stream + //was let open. + try + { + conn.getInputStream().close(); + } + catch (Exception exception) + { + // Ignored + } + } + } } catch (IOException e)