Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0-RC1
    • Fix Version/s: 2.5.0-rc1
    • Component/s: Core
    • Labels:
      None

      Description

      public void output(ConfigurationResolveReport report, String resolveId, String[] confs, ResolutionCacheManager cacheMgr) throws IOException {
           File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId,
                  report.getConfiguration());
           File reportParentDir = reportFile.getParentFile();
           reportParentDir.mkdirs(); // NPE
           OutputStream stream = new FileOutputStream(reportFile);
           writer.output(report, confs, stream);
           stream.close();
           //...
      }
      

      In XmlReportOutputter.output method, NPE occurs when reportFile.getParentFile() returns null. I think a proper error handling is needed for reportFile and reportParentDir before OutputStream is created.

      <Test case>

      public void test1() {
        Ivy14 ivy = new org.apache.ivy.Ivy14();
        ManifestHeaderElement header = new ManifestHeaderElement();
        ModuleRevisionId resolveId = ModuleRevisionId.newInstance("", "ISO-8859-1", "default", "default", header.getAttributes(), true);
        Pack200Packing pack = new Pack200Packing();
        String[] strings = pack.getNames();
        ResolveReport report = ivy.resolve(resolveId, strings);
        ResolveOptions options = new ResolveOptions();
        report.output(new ReportOutputter[]{new XmlReportOutputter()}, (ResolutionCacheManager)new DefaultResolutionCacheManager(), options.setResolveId("latest-revision").setOutputReport(true));
      }
      

      <Stack trace>

      1) test1(Test0)java.lang.NullPointerException
      at org.apache.ivy.plugins.report.XmlReportOutputter.output(XmlReportOutputter.java:56)
      at org.apache.ivy.plugins.report.XmlReportOutputter.output(XmlReportOutputter.java:47)
      at org.apache.ivy.core.report.ResolveReport.output(ResolveReport.java:106)
      at Test0.test1(Test0.java:48)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                maartenc Maarten Coene
                Reporter:
                mjkim0324 M Kim
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: