You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/03/28 12:11:11 UTC

svn commit: r642199 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/ant/ test/buildlist/F/ test/buildlist/G/ test/java/org/apache/ivy/ant/

Author: xavier
Date: Fri Mar 28 04:11:06 2008
New Revision: 642199

URL: http://svn.apache.org/viewvc?rev=642199&view=rev
Log:
FIX: Out of memory/Stack overflow for new highly coupled project (IVY-595)

Added:
    ant/ivy/core/trunk/test/buildlist/F/
    ant/ivy/core/trunk/test/buildlist/F/build.xml   (with props)
    ant/ivy/core/trunk/test/buildlist/F/ivy.xml   (with props)
    ant/ivy/core/trunk/test/buildlist/G/
    ant/ivy/core/trunk/test/buildlist/G/build.xml   (with props)
    ant/ivy/core/trunk/test/buildlist/G/ivy.xml   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=642199&r1=642198&r2=642199&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Mar 28 04:11:06 2008
@@ -75,6 +75,7 @@
 - IMPROVEMENT: Parse description and home page from poms (IVY-767)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher
 
+- FIX: Out of memory/Stack overflow for new highly coupled project (IVY-595)
 - FIX: Compatibility with maven's dependencyMangement (IVY-753) (not completed yet)
 - FIX: ivy:settings fails when override is not set to 'true' (IVY-771)
 - FIX: NPE when specifying both resolveId and inline in an Ivy:Resolve (IVY-776)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java?rev=642199&r1=642198&r2=642199&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java Fri Mar 28 04:11:06 2008
@@ -357,10 +357,13 @@
         DependencyDescriptor[] deps = node.getDependencies();
         for (int i = 0; i < deps.length; i++) {
             ModuleId id = deps[i].getDependencyId();
-            if (moduleIdMap.get(id) != null) {
-                toKeep.add(moduleIdMap.get(id));
+            ModuleDescriptor md = (ModuleDescriptor) moduleIdMap.get(id);
+            // we test if this module id has a module descriptor, and if it isn't already in the 
+            // toKeep Set, in which there's probably a circular dependency
+            if (md != null && !toKeep.contains(md)) { 
+                toKeep.add(md);
                 if (!getOnlydirectdep()) {
-                    processFilterNodeFromRoot((ModuleDescriptor) moduleIdMap.get(id), toKeep,
+                    processFilterNodeFromRoot(md, toKeep,
                         moduleIdMap);
                 }
             }

Added: ant/ivy/core/trunk/test/buildlist/F/build.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/buildlist/F/build.xml?rev=642199&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/buildlist/F/build.xml (added)
+++ ant/ivy/core/trunk/test/buildlist/F/build.xml Fri Mar 28 04:11:06 2008
@@ -0,0 +1,18 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->

Propchange: ant/ivy/core/trunk/test/buildlist/F/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/buildlist/F/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/buildlist/F/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/buildlist/F/ivy.xml?rev=642199&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/buildlist/F/ivy.xml (added)
+++ ant/ivy/core/trunk/test/buildlist/F/ivy.xml Fri Mar 28 04:11:06 2008
@@ -0,0 +1,24 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.2">
+	<info organisation="apache" module="F"/>
+	<dependencies>
+		<dependency name="G" rev="latest.integration"/>
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/buildlist/F/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/buildlist/F/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/buildlist/G/build.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/buildlist/G/build.xml?rev=642199&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/buildlist/G/build.xml (added)
+++ ant/ivy/core/trunk/test/buildlist/G/build.xml Fri Mar 28 04:11:06 2008
@@ -0,0 +1,18 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->

Propchange: ant/ivy/core/trunk/test/buildlist/G/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/buildlist/G/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/buildlist/G/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/buildlist/G/ivy.xml?rev=642199&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/buildlist/G/ivy.xml (added)
+++ ant/ivy/core/trunk/test/buildlist/G/ivy.xml Fri Mar 28 04:11:06 2008
@@ -0,0 +1,24 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.2">
+	<info organisation="apache" module="G"/>
+	<dependencies>
+		<dependency name="F" rev="latest.integration"/>
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/buildlist/G/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/buildlist/G/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java?rev=642199&r1=642198&r2=642199&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java Fri Mar 28 04:11:06 2008
@@ -35,6 +35,8 @@
      * C -> B
      * D -> A , B
      * E has no dependency
+     * F -> G
+     * G -> F
      */
 
     //CheckStyle:MagicNumber| OFF   
@@ -50,6 +52,7 @@
         FileSet fs = new FileSet();
         fs.setDir(new File("test/buildlist"));
         fs.setIncludes("**/build.xml");
+        fs.setExcludes("F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
 
         buildlist.setReference("ordered.build.files");
@@ -88,6 +91,7 @@
         FileSet fs = new FileSet();
         fs.setDir(new File("test/buildlist"));
         fs.setIncludes("**/build.xml");
+        fs.setExcludes("F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
 
         buildlist.setReference("reverse.ordered.build.files");
@@ -148,6 +152,32 @@
                 .getAbsolutePath());
     }
 
+    public void testWithRootCircular() {
+        Project p = new Project();
+
+        IvyBuildList buildlist = new IvyBuildList();
+        buildlist.setProject(p);
+        buildlist.setRoot("F");
+
+        FileSet fs = new FileSet();
+        fs.setDir(new File("test/buildlist"));
+        fs.setIncludes("**/build.xml");
+        buildlist.addFileset(fs);
+
+        buildlist.setReference("ordered.build.files");
+
+        buildlist.execute();
+
+        Object o = p.getReference("ordered.build.files");
+        assertNotNull(o);
+        assertTrue(o instanceof Path);
+
+        Path path = (Path) o;
+        String[] files = path.list();
+        assertNotNull(files);
+        assertEquals(2, files.length); // F and G should be in the list
+    }
+
     public void testWithTwoRoots() {
         Project p = new Project();
 
@@ -282,6 +312,33 @@
                 .getAbsolutePath());
     }
 
+    public void testWithLeafCircular() {
+        Project p = new Project();
+
+        IvyBuildList buildlist = new IvyBuildList();
+        buildlist.setProject(p);
+        buildlist.setLeaf("F");
+
+        FileSet fs = new FileSet();
+        fs.setDir(new File("test/buildlist"));
+        fs.setIncludes("**/build.xml");
+        buildlist.addFileset(fs);
+
+        buildlist.setReference("ordered.build.files");
+
+        buildlist.execute();
+
+        Object o = p.getReference("ordered.build.files");
+        assertNotNull(o);
+        assertTrue(o instanceof Path);
+
+        Path path = (Path) o;
+        String[] files = path.list();
+        assertNotNull(files);
+        
+        assertEquals(2, files.length); 
+    }
+
     public void testWithTwoLeafs() {
         Project p = new Project();
 
@@ -395,6 +452,7 @@
         FileSet fs = new FileSet();
         fs.setDir(new File("test/buildlist"));
         fs.setIncludes("**/build.xml");
+        fs.setExcludes("F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
 
         buildlist.setReference("ordered.build.files");