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

2018-02-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IVY-1545:
-

Github user asfgit closed the pull request at:

https://github.com/apache/ant-ivy/pull/66


> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(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 
> 

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

2018-02-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IVY-1545:
-

Github user jaikiran commented on the issue:

https://github.com/apache/ant-ivy/pull/66
  
@javabrett, thank you reporting as well as providing the fix for this. This 
is now merged.


> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(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 

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

2018-02-04 Thread Brett Randall (JIRA)

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

Brett Randall commented on IVY-1545:


Done.

> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(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 
> 

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

2018-02-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IVY-1545:
-

Github user twogee commented on the issue:

https://github.com/apache/ant-ivy/pull/66
  
@javabrett - could you please rebase your branch and force push?


> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(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 
> 

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

2018-02-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IVY-1545:
-

GitHub user twogee opened a pull request:

https://github.com/apache/ant-ivy/pull/66

IVY-1545 Detect circular dependencies in POMs



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/javabrett/ant-ivy IVY-1545

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ant-ivy/pull/66.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #66


commit dee9aa6d043d184a521f6ed970b71cbb3cab0b02
Author: Brett Randall 
Date:   2016-03-25T09:55:15Z

Added logging to help diagnose a recursion StackOverflowError condition.

commit 335be3eb2c9d2b10786dff790fb78206d1e31523
Author: Brett Randall 
Date:   2016-03-26T08:15:25Z

Fixed two minor comment typos.

commit 65b9650cbc7a4b8b9faa560a50eafa826fcd6fae
Author: Brett Randall 
Date:   2016-03-26T02:12:20Z

IVY-1545: Added tracking for a cycle in parent-POM ancestry, throw a 
CircularDependencyException if found.
Added tests for cycles in parent ancestry and references-self as parent.




> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(PomReader.java:121)
> at 
> org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:119)
> at 
> 

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

2016-03-26 Thread Brett Randall (JIRA)

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

Brett Randall commented on IVY-1545:


I couldn't find the exact docs on contributing changes - GitHub will do for 
now: https://github.com/apache/ant-ivy/compare/master...javabrett:IVY-1545 .

> 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
>Priority: Minor
>   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.(String.java:415)
> at java.lang.String.(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.(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.(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 
>