You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "David Jencks (JIRA)" <de...@geronimo.apache.org> on 2006/06/10 17:59:30 UTC

[jira] Closed: (GERONIMO-2104) NPE in maven1repo when bad directory name is listed

     [ 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 {                                                                                                                                                                                                  

-- 
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


Re: [jira] Closed: (GERONIMO-2104) NPE in maven1repo when bad directory name is listed

Posted by Donald Woods <dr...@yahoo.com>.
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 {                                                                                                                                                                                                  
> 
>