How can I compare two lists in Groovy

I’d just use the arithmetic operators, I think it’s much more obvious what’s going on: def a = [“foo”, “bar”, “baz”, “baz”] def b = [“foo”, “qux”] assert [“bar”, “baz”, “baz”, “qux”] == ((a – b) + (b – a))

Groovy: How can I include backslashes inside a string without escaping?

Wow, another gotcha with putting Windows files paths in slashy strings. Nice catch. The gotcha I’ve encountered before was including a trailing backslash on the path, e.g. /C:\path\/, which results in an unexpected char: 0xFFFF error. Anyways, for the sake of an answer, given that Windows paths are case insensitive, why not exploit it for … Read more

How to disable accessExternalDTD and entityExpansionLimit warnings with logback

This is a known bug in the JRE that reports this as an warning. See bug reports here and here The issue happens only when you have xerces jar in your classpath, the xerces implementation does not recognize the property and throws an exception on org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.setProperty() which results in a warning log (to System.err) from … Read more

How do I print a Groovy stack trace?

Solution: org.codehaus.groovy.runtime.StackTraceUtils.sanitize(new Exception()).printStackTrace() Original answer: A Google search returns the following information: Apparently, there is a method in org.codehaus.groovy.runtime.StackTraceUtils called printSanitizedStackTrace. There isn’t much documentation for the method, though there is a method called sanitize which is described as remove all apparently groovy-internal trace entries from the exception instance This modifies the original instance and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)