Ivy
  1. Ivy
  2. IVY-1343

NullPointerExeption in AbstractOSGiResolver

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3.0-RC1
    • Fix Version/s: 2.3.0-RC2, 2.4.0-RC1
    • Component/s: Core
    • Labels:
    • Environment:

      Ubuntu 2.6.32-25-generic-pae,
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

      Apache Ant version 1.8.0 compiled on April 9 2010

      Description

      A NullPointerException is thrown, if I try to resolve a dependency after I cleared the cache.

      Steps to reproduce:

      1. create a ivysettings.xml with a chain including a ibiblio and an updatesite as resolver.
      2. create a dependency to a artifact that can be found with the ibiblio resolver.
      3. call ivy retrieve

      actual result:

      • no dependency is resolved and retrieved and a NullPointerException is thrown

      expected result:

      • dependency is resolved and retrieved from ibiblio

      See also the attached patch and test case.


      problem occurred while resolving dependency: org.mod4j.com.ibm#icu;4.0.1

      {compile=[*, !sources, !javadoc]}

      with p2-repos: java.lang.NullPointerException
      at org.apache.ivy.osgi.repo.AbstractOSGiResolver.findIvyFileRef(AbstractOSGiResolver.java:132)
      at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:228)
      at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
      at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:169)
      at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:292)
      at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:695)
      at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:780)
      at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:703)
      at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:575)
      at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:233)
      at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:194)
      at org.apache.ivy.Ivy.resolve(Ivy.java:503)
      at org.apache.ivy.Main.run(Main.java:270)
      at org.apache.ivy.Main.main(Main.java:179)

      1. patch.txt
        0.8 kB
        Thomas Kurpick
      2. UpdateSiteAndIbiblioResolverTest.java
        4 kB
        Thomas Kurpick

        Activity

        Thomas Kurpick created issue -
        Hide
        Thomas Kurpick added a comment -

        Test Case for NullPointerException

        Show
        Thomas Kurpick added a comment - Test Case for NullPointerException
        Thomas Kurpick made changes -
        Field Original Value New Value
        Attachment UpdateSiteAndIbiblioResolverTest.java [ 12522917 ]
        Thomas Kurpick made changes -
        Comment [ Patch for AbstractOSGiResolver

        Index: src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
        ===================================================================
        --- src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java (revision 1326555)
        +++ src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java (working copy)
        @@ -294,7 +294,10 @@
         
             public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
                 URL url = artifact.getUrl();
        - Message.verbose("\tusing url for " + artifact + ": " + url);
        + if (url == null) {
        + return null;
        + }
        + Message.verbose("\tusing url for " + artifact + ": " + url.toExternalForm());
                 logArtifactAttempt(artifact, url.toExternalForm());
                 Resource resource = new URLResource(url);
                 return new ResolvedResource(resource, artifact.getModuleRevisionId().getRevision());
        ]
        Hide
        Thomas Kurpick added a comment -

        Patch for AbstractOSGiResolver

        Show
        Thomas Kurpick added a comment - Patch for AbstractOSGiResolver
        Thomas Kurpick made changes -
        Attachment patch.txt [ 12522918 ]
        Maarten Coene made changes -
        Original Estimate 0.5h [ 1800 ]
        Remaining Estimate 0.5h [ 1800 ]
        Affects Version/s 2.3.0 [ 12320743 ]
        Affects Version/s trunk [ 12320744 ]
        Hide
        Nicolas Lalevée added a comment -

        Thanks for the test and the patch!

        Show
        Nicolas Lalevée added a comment - Thanks for the test and the patch!
        Nicolas Lalevée made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Nicolas Lalevée [ hibou ]
        Fix Version/s 2.3.0 [ 12320743 ]
        Fix Version/s trunk [ 12320744 ]
        Resolution Fixed [ 1 ]
        Maarten Coene made changes -
        Fix Version/s 2.4.0-RC1 [ 12326648 ]
        Fix Version/s trunk [ 12320744 ]

          People

          • Assignee:
            Nicolas Lalevée
            Reporter:
            Thomas Kurpick
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development