geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r413323 - /geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
Date Sat, 10 Jun 2006 15:58:43 GMT
Author: djencks
Date: Sat Jun 10 08:58:43 2006
New Revision: 413323

URL: http://svn.apache.org/viewvc?rev=413323&view=rev
Log:
GERONIMO-2104 fix NPE when bad directory is listed

Modified:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java?rev=413323&r1=413322&r2=413323&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
Sat Jun 10 08:58:43 2006
@@ -66,16 +66,18 @@
             path = new File(path, query.getType() + "s");
 
             File[] files = path.listFiles();
-            for (int i = 0; i < files.length; i++) {
-                File file = files[i];
-                String fileName = file.getName();
-                if (fileName.startsWith(query.getArtifactId() + "-") && fileName.endsWith("."
+ query.getType())) {
-                    String version = fileName.substring(query.getArtifactId().length() +
1);
-                    version = version.substring(0, version.length() - 1 - query.getType().length());
-                    if(query.getVersion() != null && !query.getVersion().toString().equals(version))
{
-                        continue;
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    File file = files[i];
+                    String fileName = file.getName();
+                    if (fileName.startsWith(query.getArtifactId() + "-") && fileName.endsWith("."
+ query.getType())) {
+                        String version = fileName.substring(query.getArtifactId().length()
+ 1);
+                        version = version.substring(0, version.length() - 1 - query.getType().length());
+                        if(query.getVersion() != null && !query.getVersion().toString().equals(version))
{
+                            continue;
+                        }
+                        artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(),
version, query.getType()));
                     }
-                    artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(),
version, query.getType()));
                 }
             }
         } else {



Mime
View raw message