Skip to content

Commit d0d4856

Browse files
committed
Merge branch '1.2.x' of github.com:grails/grails-core into 1.2.x
2 parents 0cf1a03 + d1dd77d commit d0d4856

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

scripts/Console.groovy

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ target ('default': "Load the Grails interactive Swing console") {
3232
}
3333

3434
target(console:"The console implementation target") {
35-
36-
// classLoader = new URLClassLoader([classesDir.toURI().toURL()] as URL[], rootLoader)
37-
// Thread.currentThread().setContextClassLoader(classLoader)
38-
loadApp()
39-
configureApp()
35+
depends(loadApp, configureApp)
4036

4137
try {
4238
def console = createConsole()
@@ -55,7 +51,7 @@ target(console:"The console implementation target") {
5551
println "Exiting console"
5652
console.exit()
5753
String scriptText = console.inputArea.text
58-
createConsole()
54+
console = createConsole()
5955
println "Restarting console"
6056
console.run()
6157
console.inputArea.addFocusListener(new ConsoleFocusListener(text:scriptText))

scripts/_GrailsBootstrap.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import org.springframework.core.io.FileSystemResourceLoader
2626
import org.springframework.mock.web.MockServletContext
2727
import org.springframework.web.context.WebApplicationContext
2828
import org.springframework.mock.jndi.SimpleNamingContextBuilder
29+
import org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean
30+
import org.springframework.core.io.FileSystemResource
2931

3032

3133
/**
@@ -51,6 +53,12 @@ target(loadApp:"Loads the Grails application object") {
5153
grailsResourceHolder = resourceHolder
5254
}
5355
grailsApplication(org.codehaus.groovy.grails.commons.DefaultGrailsApplication, ref("grailsResourceLoader"))
56+
57+
// There is a pluginManager variable in the binding
58+
delegate."pluginManager"(GrailsPluginManagerFactoryBean) {
59+
application = grailsApplication
60+
grailsDescriptor = new FileSystemResource("web-app/WEB-INF/grails.xml")
61+
}
5462
}
5563
}
5664

src/java/org/codehaus/groovy/grails/web/json/JSONObject.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,11 +1157,11 @@ public boolean isEmpty() {
11571157
}
11581158

11591159
public boolean containsKey(Object o) {
1160-
return false;
1160+
return myHashMap.containsKey(o);
11611161
}
11621162

11631163
public boolean containsValue(Object o) {
1164-
return this.myHashMap.containsKey(o);
1164+
return this.myHashMap.containsValue(o);
11651165
}
11661166

11671167
public Object get(Object o) {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.codehaus.groovy.grails.web.json
2+
3+
/**
4+
* @author Graeme Rocher
5+
* @since 1.0
6+
*/
7+
class JSONObjectTests extends GroovyTestCase {
8+
9+
10+
void testContainsKey() {
11+
JSONObject j = new JSONObject();
12+
j.put('test', 1)
13+
assert j.containsKey('test')
14+
}
15+
16+
void testContainsValue() {
17+
JSONObject j = new JSONObject();
18+
j.put('test', 1)
19+
assert j.containsValue(1)
20+
21+
}
22+
}

0 commit comments

Comments
 (0)