You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mc...@apache.org on 2009/10/28 16:50:17 UTC

svn commit: r830646 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java

Author: mconcini
Date: Wed Oct 28 15:50:16 2009
New Revision: 830646

URL: http://svn.apache.org/viewvc?rev=830646&view=rev
Log:
MYFACES-2391

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java?rev=830646&r1=830645&r2=830646&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/ClassLoaderResourceLoader.java Wed Oct 28 15:50:16 2009
@@ -118,13 +118,16 @@
                     for (int i = 0; i < versions.length; i++)
                     {
                         String version = versions[i].getName();
-                        if (libraryVersion == null)
+                        if (VERSION_CHECKER.matcher(version).matches())
                         {
-                            libraryVersion = version;
-                        }
-                        else if (getVersionComparator().compare(libraryVersion, version) < 0)
-                        {
-                            libraryVersion = version;
+                            if (libraryVersion == null)
+                            {
+                                libraryVersion = version;
+                            }
+                            else if (getVersionComparator().compare(libraryVersion, version) < 0)
+                            {
+                                libraryVersion = version;
+                            }
                         }
                     }
                 }
@@ -183,13 +186,16 @@
                                     }
     
                                     String version = entryName;
-                                    if (libraryVersion == null)
+                                    if (VERSION_CHECKER.matcher(version).matches())
                                     {
-                                        libraryVersion = version;
-                                    }
-                                    else if (getVersionComparator().compare(libraryVersion, version) < 0)
-                                    {
-                                        libraryVersion = version;
+                                        if (libraryVersion == null)
+                                        {
+                                            libraryVersion = version;
+                                        }
+                                        else if (getVersionComparator().compare(libraryVersion, version) < 0)
+                                        {
+                                            libraryVersion = version;
+                                        }
                                     }
                                 }
                             }
@@ -321,29 +327,19 @@
                                         // 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)
+        
+                                    entryName = entryName.substring(path.length());
+                                    if (RESOURCE_VERSION_CHECKER.matcher(entryName).matches())
                                     {
-                                        resourceVersion = version;
+                                        String version = entryName.substring(1, entryName.lastIndexOf('.'));
+                                        if (resourceVersion == null)
+                                        {
+                                            resourceVersion = version;
+                                        }
+                                        else if (getVersionComparator().compare(resourceVersion, version) < 0)
+                                        {
+                                            resourceVersion = version;
+                                        }
                                     }
                                 }
                             }