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

NullPointerException when accessing charset to invalid URL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.4.0
    • 2.4.0
    • None
    • None
    • windows 7

    Description

      Trace is:
      java.lang.NullPointerException: charsetName
      at java.io.InputStreamReader.<init>(Unknown Source)
      at org.apache.ivy.util.url.ApacheURLLister.retrieveListing(ApacheURLLister.java:113)
      at org.apache.ivy.util.url.ApacheURLLister.listAll(ApacheURLLister.java:57)
      at org.apache.ivy.plugins.repository.url.URLRepository.list(URLRepository.java:100)
      at org.apache.ivy.plugins.resolver.util.ResolverHelper.listAll(ResolverHelper.java:105)
      at org.apache.ivy.plugins.resolver.util.ResolverHelper.listTokenValues(ResolverHelper.java:57)
      at org.apache.ivy.plugins.resolver.util.ResolverHelper.findAll(ResolverHelper.java:139)
      at org.apache.ivy.plugins.resolver.RepositoryResolver.listResources(RepositoryResolver.java:185)
      at org.apache.ivy.plugins.resolver.RepositoryResolver.findDynamicResourceUsingPattern(RepositoryResolver.java:149)
      at org.apache.ivy.plugins.resolver.RepositoryResolver.findResourceUsingPattern(RepositoryResolver.java:132)
      at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findResourceUsingPatterns(AbstractPatternsBasedResolver.java:96)
      at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findArtifactRef(AbstractPatternsBasedResolver.java:75)
      at org.apache.ivy.plugins.resolver.BasicResolver.getArtifactRef(BasicResolver.java:1034)
      at org.apache.ivy.plugins.resolver.BasicResolver.findFirstArtifactRef(BasicResolver.java:971)
      at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:243)
      at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
      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:717)
      at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:802)
      at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:725)
      at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:597)
      at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:234)
      at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:195)
      at org.apache.ivy.Ivy.resolve(Ivy.java:507)
      at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:337)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:273)
      at org.apache.ivy.ant.IvyPostResolveTask.ensureResolved(IvyPostResolveTask.java:241)
      at org.apache.ivy.ant.IvyPostResolveTask.prepareAndCheck(IvyPostResolveTask.java:188)
      at org.apache.ivy.ant.IvyRetrieve.doExecute(IvyRetrieve.java:89)
      at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:273)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:392)
      at org.apache.tools.ant.Target.performTasks(Target.java:413)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
      at org.apache.tools.ant.Main.runBuild(Main.java:811)
      at org.apache.tools.ant.Main.startAnt(Main.java:217)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

      After investigations, a check is missing in in class org.apache.ivy.util.url.ApacheURLLister, in method
      List retrieveListing(URL,boolean,boolean) :

      [...]
      String charset = urlHandler.getURLInfo(url).getBodyCharset();
      [...]
      According to spec of urlHandler.getURLInfo(url), it may return URLHandler.UNAVAILABLE.

      I have replace the above line by the following and it works fine:
      [...]
      URLInfo urlInfo = urlHandler.getURLInfo(url);
      if(urlInfo == URLHandler.UNAVAILABLE)
      return urlList; // not found => return empty list
      // here, urlInfo is valid
      String charset = urlInfo.getBodyCharset();
      [...]

      This is blocking for us. Is there a chance to integrate it soon ?
      Otherwise, I will need to build my own patched jar.

      Attachments

        Issue Links

          Activity

            People

              hibou Nicolas Lalevée
              friviere Frédéric RIVIERE
              Votes:
              6 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified