geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <...@geronimo.apache.org>
Subject [jira] Created: (GERONIMO-2104) NPE in maven1repo when bad directory name is listed
Date Sat, 10 Jun 2006 15:57:29 GMT
NPE in maven1repo when bad directory name is listed
---------------------------------------------------

         Key: GERONIMO-2104
         URL: http://issues.apache.org/jira/browse/GERONIMO-2104
     Project: Geronimo
        Type: Bug
    Security: public (Regular issues) 
  Components: buildsystem  
    Versions: 1.1, 1.2    
    Reporter: David Jencks
 Assigned to: David Jencks 
     Fix For: 1.2


This patch fixes a pretty obvious NPE source:

Index: modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
===================================================================
--- modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (revision
413322)
+++ modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (working
copy)
@@ -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 {                                                                        
                                                                                         
                               

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message