Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 1.7.10
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:JDK 1.6
-
Testcase included:yes
-
Number of attachments :
Description
// Java delegate class public class TheDelegate { public void setDelegatesPropertyThrowsException(Object value) throws javax.mail.internet.AddressException { throw new AddressException("Just an example."); } } // the closure call (Java) public void methodThatTakesAClosure(Closure cl) { final TheDelegate delegate = new TheDelegate(); // ... closure = (Closure)cl.clone(); closure.setResolveStrategy(Closure.DELEGATE_FIRST); closure.setDelegate(delegate); closure.call(delegate); // no exception is seen here // ... }
The following script does not get the exception thrown by setDelegatesPropertyThrowsException.
// Groovy script thing.methodThatTakesAClosure { delegatesPropertyThrowsException = "tryThis" } assert delegatesPropertyThrowsException == "tryThis" // this was the MOP's second try
I couldn't reproduce the error with Groovy 1.7.10. It correctly threw the exception for me.
Also, does it have anything to do with GroovyScriptEngine (the component chosen for the bug)? The sample code shows no relation to it.