You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "jaikiran pai (JIRA)" <ji...@apache.org> on 2018/02/09 03:52:00 UTC

[jira] [Assigned] (IVY-1545) Cycle in parent POM ancestry yields StackOverflowError in PomModuleDescriptorParser

     [ https://issues.apache.org/jira/browse/IVY-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jaikiran pai reassigned IVY-1545:
---------------------------------

    Assignee: jaikiran pai

> Cycle in parent POM ancestry yields StackOverflowError in PomModuleDescriptorParser
> -----------------------------------------------------------------------------------
>
>                 Key: IVY-1545
>                 URL: https://issues.apache.org/jira/browse/IVY-1545
>             Project: Ivy
>          Issue Type: Bug
>          Components: Maven Compatibility
>    Affects Versions: 2.4.0, master
>            Reporter: Brett Randall
>            Assignee: jaikiran pai
>            Priority: Minor
>             Fix For: master
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> If the parent-hierarchy of a POM contains a cycle, or the artifact references itself as its parent, a {{StackOverflowError}} as {{PomModuleDescriptorParser}} recursively attempts to walk the parent ancestry (see stack trace below).  It does this while it looks for properties in parent POMs.  Obviously the artifact and/or parent structure is bad (contains a cycle) and needs to be corrected, but it would be helpful if Ivy threw a more meaningful error in this case.
> This can be exposed with two new tests I authored, {{ResolveTest#testErrorResolveMaven2ParentPomWithCycle()}} and {{ResolveTest#testErrorResolveMaven2SelfAsParent()}}.
> My solution is to {{pushNewCopyContext}} on entry to {{parseDescriptor}}, then get/add a new {{LinkedHashSet}} to track parents seen in a walk, and throw a {{CircularDependencyException}} should we encounter a cycle.
> {noformat}
> java.lang.StackOverflowError
> at java.lang.String.checkBounds(String.java:370)
> at java.lang.String.<init>(String.java:415)
> at java.lang.String.<init>(String.java:481)
> at java.io.UnixFileSystem.canonicalize0(Native Method)
> at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:172)
> at java.io.File.getCanonicalPath(File.java:618)
> at java.io.FilePermission$1.run(FilePermission.java:221)
> at java.io.FilePermission$1.run(FilePermission.java:209)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.io.FilePermission.init(FilePermission.java:209)
> at java.io.FilePermission.<init>(FilePermission.java:285)
> at sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:225)
> at sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:156)
> at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:126)
> at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:81)
> at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
> at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150)
> at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:233)
> at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:94)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:87)
> at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:283)
> at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:255)
> at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
> at org.apache.ivy.util.XMLHelper.getDocBuilder(XMLHelper.java:228)
> at org.apache.ivy.util.XMLHelper.parseToDom(XMLHelper.java:222)
> at org.apache.ivy.plugins.parser.m2.PomReader.<init>(PomReader.java:121)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:119)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:109)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:826)
> at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:843)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:1358)
> at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:538)
> at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:273)
> at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:103)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseOtherPom(PomModuleDescriptorParser.java:394)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:139)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:109)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:826)
> at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:843)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:1358)
> at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:538)
> at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:273)
> at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:103)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseOtherPom(PomModuleDescriptorParser.java:394)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:139)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:109)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:826)
> at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:843)
> at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:1358)
> at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:538)
> at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:273)
> at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:103)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseOtherPom(PomModuleDescriptorParser.java:394)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:139)
> at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:109)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)