private Object makeInstance(final PicoContainer container, final Constructor constructor, final ComponentMonitor monitor) { long startTime = System.currentTimeMillis(); Constructor constructorToUse = monitor.instantiating(container, IterativeInjector.this, constructor); Object componentInstance; try { componentInstance = newInstance(constructorToUse, null); } catch (InvocationTargetException e) { monitor.instantiationFailed(container, IterativeInjector.this, constructorToUse, e); if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException)e.getTargetException(); } else if (e.getTargetException() instanceof Error) { throw (Error)e.getTargetException(); } throw new PicoCompositionException(e.getTargetException()); } catch (InstantiationException e) { return caughtInstantiationException(monitor, constructor, e, container); } catch (IllegalAccessException e) { return caughtIllegalAccessException(monitor, constructor, e, container); } monitor.instantiated(container, IterativeInjector.this, constructorToUse, componentInstance, NONE, System.currentTimeMillis() - startTime); return componentInstance; }
private Object makeInstance(final PicoContainer container, final Constructor constructor, final ComponentMonitor monitor) { long startTime = System.currentTimeMillis(); Constructor constructorToUse = monitor.instantiating(container, IterativeInjector.this, constructor); Object componentInstance; try { componentInstance = newInstance(constructorToUse, null); } catch (InvocationTargetException e) { monitor.instantiationFailed(container, IterativeInjector.this, constructorToUse, e); if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException)e.getTargetException(); } else if (e.getTargetException() instanceof Error) { throw (Error)e.getTargetException(); } throw new PicoCompositionException(e.getTargetException()); } catch (InstantiationException e) { return caughtInstantiationException(monitor, constructor, e, container); } catch (IllegalAccessException e) { return caughtIllegalAccessException(monitor, constructor, e, container); } monitor.instantiated(container, IterativeInjector.this, constructorToUse, componentInstance, NONE, System.currentTimeMillis() - startTime); return componentInstance; }