Skip to content

Commit d5b90ad

Browse files
author
graeme
committed
fix for failing tests
git-svn-id: https://svn.codehaus.org/grails/trunk@6812 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent a40ed64 commit d5b90ad

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/web/org/codehaus/groovy/grails/web/mapping/DefaultUrlMappingsHolder.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,24 @@ public UrlCreator getReverseMapping(final String controller, final String action
115115
mapping = (UrlMapping)mappingsLookup.get(new UrlMappingKey(controller, action, Collections.EMPTY_SET));
116116
}
117117
if(mapping == null || (mapping instanceof ResponseCodeUrlMapping)) {
118-
Set lookupParams = new HashSet(params.keySet());
119-
lookupParams.addAll(DEFAULT_ACTION_PARAMS);
118+
Set lookupParams = new HashSet(DEFAULT_ACTION_PARAMS);
119+
Set paramKeys = params.keySet();
120+
lookupParams.addAll(paramKeys);
120121
mapping = (UrlMapping)mappingsLookup.get(new UrlMappingKey(controller, null, lookupParams));
122+
if(mapping == null) {
123+
lookupParams.removeAll(paramKeys);
124+
mapping = (UrlMapping)mappingsLookup.get(new UrlMappingKey(controller, null, lookupParams));
125+
}
121126
}
122127
if(mapping == null || (mapping instanceof ResponseCodeUrlMapping)) {
123-
Set lookupParams = new HashSet(params.keySet());
124-
lookupParams.addAll(DEFAULT_CONTROLLER_PARAMS);
125-
128+
Set lookupParams = new HashSet(DEFAULT_CONTROLLER_PARAMS);
129+
Set paramKeys = params.keySet();
130+
lookupParams.addAll(paramKeys);
126131
mapping = (UrlMapping)mappingsLookup.get(new UrlMappingKey(null, null, lookupParams));
132+
if(mapping == null) {
133+
lookupParams.removeAll(paramKeys);
134+
mapping = (UrlMapping)mappingsLookup.get(new UrlMappingKey(null, null, lookupParams));
135+
}
127136
}
128137
if(mapping == null || (mapping instanceof ResponseCodeUrlMapping)) {
129138
return new DefaultUrlCreator(controller, action);

test/groovy/org/codehaus/groovy/grails/plugins/web/LoggingGrailsPluginTests.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.apache.commons.logging.LogFactory
99
import org.apache.commons.logging.impl.NoOpLog
1010
import org.codehaus.groovy.grails.commons.GrailsApplication
1111

12-
class LoggingGrailsPluginTests extends AbstractGrailsPluginTests {
12+
class LoggingGrailsPluginTests extends AbstractGrailsPluginTests {
1313

1414
def controllerClass
1515
def serviceClass
@@ -57,6 +57,8 @@ class LoggingGrailsPluginTests extends AbstractGrailsPluginTests {
5757
</context-param>
5858
</web-app>
5959
'''
60+
System.setProperty('current.gant.script','')
61+
6062
def xml = new XmlSlurper().parseText( xmlText )
6163
System.setProperty(GrailsApplication.PROJECT_RESOURCES_DIR, "/test")
6264
def plugin = new LoggingGrailsPlugin()

0 commit comments

Comments
 (0)