geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <drw_...@yahoo.com>
Subject Re: [jira] Closed: (GERONIMO-2104) NPE in maven1repo when bad directory name is listed
Date Sat, 10 Jun 2006 16:13:02 GMT
Seems like a simple patch that should also go into 1.1, since all it 
does is check for null...


-Donald

David Jencks (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/GERONIMO-2104?page=all ]
>      
> David Jencks closed GERONIMO-2104:
> ----------------------------------
> 
>     Resolution: Fixed
> 
> Applied in rev 413323 to trunk (1.2).  I have no opinion on applying to 1.1.1
> 
> 
>>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
>>    Assignee: 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 {                                                                
                                                                                         
                                       
> 
> 

Mime
View raw message