ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin (JIRA)" <>
Subject [jira] Commented: (IVY-831) NPE in AbstractResolver.exists() if a resource cannot be found
Date Tue, 10 Jun 2008 10:52:44 GMT


Xavier Hanin commented on IVY-831:

I've just checked in what should fix the NPE. But I've checked the code, and I haven't found
any implementation of download which can return null. Therefore I've added javadoc to the
download method to clarify its contract specifying it must never return null. Hence the prevention
against the NPE in AbstractResolver shouldn't be required, but I let it in case a bad implementation
of DependencyResolver (according to the contract I've just defined) is used.

Could you confirm you don't have the NPE anymore, and tell me if you get an IllegalStateException,
and if such, with which resolver implementation?

> NPE in AbstractResolver.exists() if a resource cannot be found
> --------------------------------------------------------------
>                 Key: IVY-831
>                 URL:
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-RC1
>            Reporter: Erik-Berndt Scheper
>            Assignee: Xavier Hanin
>             Fix For: 2.0-RC1
> A NullPointerException occurs inAbstractResolver.exists( if
a host cannot be found
> Reproducible with "ant coverage-report" behind a firewall with proxy install disabled.
> Resulting stack trace:
> {noformat}
> java.lang.NullPointerException
> at org.apache.ivy.plugins.resolver.AbstractResolver.exists(
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.addSourcesAndJavadocArtifactsIfPresent(
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParserTest.testSimple(
> {noformat}
> Offending code:
> {noformat}
>     /**
>      * Default implementation actually download the artifact Subclasses should overwrite
this to
>      * avoid the download
>      */
>     public boolean exists(Artifact artifact) {
>         DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions());
>         ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
>         return adr.getDownloadStatus() != DownloadStatus.FAILED;
>     }
> {noformat}
> If the DownloadReport instance is null, a NPE occurs

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message