| @@ -217,19 +217,12 @@ public class AntTypeDefinition { | |||||
| return null; | return null; | ||||
| } | } | ||||
| Object o = createAndSet(project, c); | Object o = createAndSet(project, c); | ||||
| if (o == null || adapterClass == null) { | |||||
| if (adapterClass == null | |||||
| || (adaptToClass != null && adaptToClass.isAssignableFrom(o.getClass()))) { | |||||
| return o; | return o; | ||||
| } | } | ||||
| if (adaptToClass != null) { | |||||
| if (adaptToClass.isAssignableFrom(o.getClass())) { | |||||
| return o; | |||||
| } | |||||
| } | |||||
| TypeAdapter adapterObject = (TypeAdapter) createAndSet( | TypeAdapter adapterObject = (TypeAdapter) createAndSet( | ||||
| project, adapterClass); | project, adapterClass); | ||||
| if (adapterObject == null) { | |||||
| return null; | |||||
| } | |||||
| adapterObject.setProxy(o); | adapterObject.setProxy(o); | ||||
| return adapterObject; | return adapterObject; | ||||
| } | } | ||||
| @@ -257,9 +250,6 @@ public class AntTypeDefinition { | |||||
| || !adaptToClass.isAssignableFrom(clazz))) { | || !adaptToClass.isAssignableFrom(clazz))) { | ||||
| TypeAdapter adapter = (TypeAdapter) createAndSet( | TypeAdapter adapter = (TypeAdapter) createAndSet( | ||||
| project, adapterClass); | project, adapterClass); | ||||
| if (adapter == null) { | |||||
| throw new BuildException("Unable to create adapter object"); | |||||
| } | |||||
| adapter.checkProxyClass(clazz); | adapter.checkProxyClass(clazz); | ||||
| } | } | ||||
| } | } | ||||
| @@ -267,12 +257,11 @@ public class AntTypeDefinition { | |||||
| /** | /** | ||||
| * Get the constructor of the definition | * Get the constructor of the definition | ||||
| * and invoke it. | * and invoke it. | ||||
| * @return the instantiated <code>Object</code>. | |||||
| * @return the instantiated <code>Object</code>, will never be null. | |||||
| */ | */ | ||||
| private Object createAndSet(Project project, Class<?> c) { | private Object createAndSet(Project project, Class<?> c) { | ||||
| try { | try { | ||||
| Object o = innerCreateAndSet(c, project); | |||||
| return o; | |||||
| return innerCreateAndSet(c, project); | |||||
| } catch (InvocationTargetException ex) { | } catch (InvocationTargetException ex) { | ||||
| Throwable t = ex.getTargetException(); | Throwable t = ex.getTargetException(); | ||||
| throw new BuildException( | throw new BuildException( | ||||