Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-1512

NullPointerException in the constructor of StartRetrieveArtifactEvent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.4.0
    • None
    • Core
    • None

    Description

      A NullPointerException is thrown in a constructor of StartRetrieveArtifactEvent. It crashes in addMridAttributes of IvyEvent.java.

          protected void addMridAttributes(ModuleRevisionId mrid) {
              addModuleIdAttributes(mrid.getModuleId());  //NPE because mrid is null
             //...
          }
      

      because IvyPublish$PublishArtifact.getModuleRevisionId() returns null no matter what in addArtifactAttributes method .

          protected void addArtifactAttributes(Artifact artifact) {
              addMridAttributes(artifact.getModuleRevisionId()); //artifact.getModuleRevisionId() returns null from  IvyPublish$PublishArtifact.getModuleRevisionId()
             //...
          }
      
      

      <Stack Trace>

      test(Test0)java.lang.NullPointerException
              at org.apache.ivy.core.event.IvyEvent.addMridAttributes(IvyEvent.java:67)
              at org.apache.ivy.core.event.retrieve.RetrieveArtifactEvent.addArtifactAttributes(RetrieveArtifactEvent.java:43)
              at org.apache.ivy.core.event.retrieve.RetrieveArtifactEvent.<init>(RetrieveArtifactEvent.java:33)
              at org.apache.ivy.core.event.retrieve.StartRetrieveArtifactEvent.<init>(StartRetrieveArtifactEvent.java:28)
              at Test0.test(Test0.java:10)
      

      <Test Case>

      public void test() {
        MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport((Artifact) new IvyPublish().createArtifact());
        File file = new IvySetting().getDefaultCache();
        StartRetrieveArtifactEvent event = new StartRetrieveArtifactEvent((ArtifactDownloadReport)report, file);
      
      }
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mjkim0324 M Kim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: