Polishing

This commit is contained in:
Juergen Hoeller
2015-12-22 16:19:26 +01:00
parent 95d62658ff
commit bb0bc3d415
2 changed files with 11 additions and 8 deletions
@@ -31,7 +31,6 @@ import groovy.lang.GroovyObjectSupport;
import groovy.lang.GroovyShell; import groovy.lang.GroovyShell;
import groovy.lang.GroovySystem; import groovy.lang.GroovySystem;
import groovy.lang.MetaClass; import groovy.lang.MetaClass;
import org.codehaus.groovy.runtime.DefaultGroovyMethods; import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.codehaus.groovy.runtime.InvokerHelper; import org.codehaus.groovy.runtime.InvokerHelper;
@@ -337,8 +336,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
if (uri == null) { if (uri == null) {
throw new IllegalArgumentException("Namespace definition must supply a non-null URI"); throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
} }
NamespaceHandler namespaceHandler = this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve( NamespaceHandler namespaceHandler =
uri); this.groovyDslXmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
if (namespaceHandler == null) { if (namespaceHandler == null) {
throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri, throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
new Location(new DescriptiveResource(("Groovy"))))); new Location(new DescriptiveResource(("Groovy")))));
@@ -375,7 +374,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
throw new IllegalArgumentException("Argument to ref() is not a valid bean or was not found"); throw new IllegalArgumentException("Argument to ref() is not a valid bean or was not found");
if (args[0] instanceof RuntimeBeanReference) { if (args[0] instanceof RuntimeBeanReference) {
refName = ((RuntimeBeanReference)args[0]).getBeanName(); refName = ((RuntimeBeanReference) args[0]).getBeanName();
} }
else { else {
refName = args[0].toString(); refName = args[0].toString();
@@ -388,7 +387,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
} }
return new RuntimeBeanReference(refName, parentRef); return new RuntimeBeanReference(refName, parentRef);
} }
else if (this.namespaces.containsKey(name) && args.length > 0 && (args[0] instanceof Closure)) { else if (this.namespaces.containsKey(name) && args.length > 0 && args[0] instanceof Closure) {
GroovyDynamicElementReader reader = createDynamicElementReader(name); GroovyDynamicElementReader reader = createDynamicElementReader(name);
reader.invokeMethod("doCall", args); reader.invokeMethod("doCall", args);
} }
@@ -396,7 +395,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
// abstract bean definition // abstract bean definition
return invokeBeanDefiningMethod(name, args); return invokeBeanDefiningMethod(name, args);
} }
else if (args.length > 0 && (args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map)) { else if (args.length > 0 &&
(args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map)) {
return invokeBeanDefiningMethod(name, args); return invokeBeanDefiningMethod(name, args);
} }
else if (args.length > 1 && args[args.length -1] instanceof Closure) { else if (args.length > 1 && args[args.length -1] instanceof Closure) {
@@ -152,8 +152,11 @@ public interface Cache {
Object get(); Object get();
} }
/** /**
* TODO * Wrapper exception to be thrown from {@link #get(Object, Callable)}
* in case of the value loader callback failing with an exception.
* @since 4.3
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class ValueRetrievalException extends RuntimeException { class ValueRetrievalException extends RuntimeException {
@@ -167,7 +170,7 @@ public interface Cache {
} }
public Object getKey() { public Object getKey() {
return key; return this.key;
} }
} }