ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r667269 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/matcher/ test/java/org/apache/ivy/core/settings/
Date Thu, 12 Jun 2008 22:17:39 GMT
Author: maartenc
Date: Thu Jun 12 15:17:39 2008
New Revision: 667269

URL: http://svn.apache.org/viewvc?rev=667269&view=rev
Log:
FIX: NPE in ivy:install if ivy.settings.xml contains custom attribute for a module (IVY-838)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=667269&r1=667268&r2=667269&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jun 12 15:17:39 2008
@@ -86,6 +86,7 @@
 - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct
name (IVY-297)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher
and GlobPatternMatcher
 
+- FIX: NPE in ivy:install if ivy.settings.xml contains custom attribute for a module (IVY-838)
 - FIX: Ivy unit tests fail because 'classifier' attribute of 'artifacts' element is missing
in ivy.xsd (IVY-837)
 - FIX: Ivy build system: fix build.xml to allow "ant coverage-report" behind a proxy (IVY-832)
 - FIX: NPE in AbstractResolver.exists() if a resource cannot be found (IVY-831)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java?rev=667269&r1=667268&r2=667269&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java Thu Jun 12
15:17:39 2008
@@ -45,11 +45,14 @@
     public boolean matches(Map/*<String,String>*/ m) {
         for (Iterator iter = matchers.entrySet().iterator(); iter.hasNext();) {
             Entry entry = (Entry) iter.next();
-            if (!((Matcher) entry.getValue())
-                    .matches((String) m.get(entry.getKey()))) {
+            
+            Matcher matcher = (Matcher) entry.getValue();
+            String value = (String) m.get(entry.getKey());
+            if ((value == null) || !matcher.matches(value)) {
                 return false;
             }
         }
+        
         return true;
     }
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=667269&r1=667268&r2=667269&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java Thu
Jun 12 15:17:39 2008
@@ -174,6 +174,14 @@
         assertEquals("dynamic", settings.getResolveMode(new ModuleId("apache", "ivyde")));
         assertEquals("default", settings.getResolveMode(new ModuleId("apache", "ant")));
     }
+    
+    public void testExtraModuleAttribute() throws Exception {
+        IvySettings settings = new IvySettings();
+        XmlSettingsParser parser = new XmlSettingsParser(settings);
+        parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-extra-module-attribute.xml"));
+
+        assertEquals("default", settings.getResolveMode(new ModuleId("foo", "bar")));
+    }
 
     public void testCache() throws Exception {
         IvySettings settings = new IvySettings();

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml?rev=667269&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
Thu Jun 12 15:17:39 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.    
+-->
+<ivysettings>
+	<modules>
+		<module organisation="apache" name="ivy" myattr="test.*" matcher="regexp" resolveMode="dynamic"
/>
+		<module organisation="apache" name=".*" />
+	</modules>
+</ivysettings>



Mime
View raw message