File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
test/groovy/org/codehaus/groovy/grails/validation Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -162,16 +162,20 @@ target(generateLog4j:"Generates the Log4j config File") {
162162 def log4jConfig = config. log4j
163163 try {
164164 if (log4jConfig) {
165- def props = log4jConfig. toProperties(" log4j" )
166- log4jFile. withOutputStream { out ->
167- props. store(out, " Grails' Log4j Configuration" )
165+ if (log4jConfig instanceof ConfigObject ) {
166+ def props = log4jConfig. toProperties(" log4j" )
167+ log4jFile. withOutputStream { out ->
168+ props. store(out, " Grails' Log4j Configuration" )
169+ }
170+ }
171+ else {
172+ log4jFile. write(log4jConfig. toString())
168173 }
169174 }
170175 else {
171176 // default log4j settings
172177 createDefaultLog4J(log4jFile)
173178 }
174-
175179 }
176180 catch (Exception e) {
177181 event(" StatusFinal" , [ " Error creating Log4j config: " + e. message ])
Original file line number Diff line number Diff line change @@ -54,7 +54,16 @@ class ConstraintsBuilderTests extends AbstractGrailsMockTests {
5454 def instance = theClass. newInstance()
5555 def validator = configureValidator(theClass, instance)
5656
57+ instance. anotherURL = " http://grails.org"
5758 def errors = validateInstance(instance, validator)
59+ assert ! errors. hasErrors()
60+
61+ instance. anotherURL = " a_bad_url"
62+ errors = validateInstance(instance, validator)
63+ assert errors. hasErrors()
64+
65+ instance. anotherURL = " http://grails.org"
66+ errors = validateInstance(instance, validator)
5867
5968 assert ! errors. hasErrors()
6069
@@ -65,6 +74,9 @@ class ConstraintsBuilderTests extends AbstractGrailsMockTests {
6574 instance. url = new URL (" http://localhost:8080/tau_gwi_00/clif/cb/19" )
6675 errors = validateInstance(instance, validator)
6776 assert ! errors. hasErrors()
77+
78+
79+
6880
6981 }
7082
@@ -106,8 +118,10 @@ class Site {
106118 Long id
107119 Long version
108120 URL url
121+ String anotherURL
109122 static constraints = {
110123 url(url:true, nullable:true)
124+ anotherURL(url:true, nullable:true)
111125 }
112126}
113127 ''' )
You can’t perform that action at this time.
0 commit comments