private static void setInstanceManager(StandardContext stdContext, InstanceManager instanceManager) { try { Method method = SecurityActions.lookupMethod(stdContext.getClass(), INSTANCE_MANAGER_SETTER_NAME, InstanceManager.class); SecurityActions.ensureAccessible(method); try { method.invoke(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorInvokingMethod(method.getName(), stdContext, instanceManager); } } catch (NoSuchMethodException e1) { // Getter/setter not found } try { Field field = SecurityActions.lookupField(stdContext.getClass(), INSTANCE_MANAGER_FIELD_NAME); SecurityActions.ensureAccessible(field); try { field.set(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorWritingField(field.getName(), stdContext, instanceManager); } } catch (NoSuchFieldException e1) { // Field not found } throw TomcatLogger.LOG.neitherFieldNorGetterSetterFound(stdContext.getClass()); }
private static void setInstanceManager(StandardContext stdContext, InstanceManager instanceManager) { try { Method method = SecurityActions.lookupMethod(stdContext.getClass(), INSTANCE_MANAGER_SETTER_NAME, InstanceManager.class); SecurityActions.ensureAccessible(method); try { method.invoke(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorInvokingMethod(method.getName(), stdContext, instanceManager); } } catch (NoSuchMethodException e1) { // Getter/setter not found } try { Field field = SecurityActions.lookupField(stdContext.getClass(), INSTANCE_MANAGER_FIELD_NAME); SecurityActions.ensureAccessible(field); try { field.set(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorWritingField(field.getName(), stdContext, instanceManager); } } catch (NoSuchFieldException e1) { // Field not found } throw TomcatLogger.LOG.neitherFieldNorGetterSetterFound(stdContext.getClass()); }
private static void setInstanceManager(StandardContext stdContext, InstanceManager instanceManager) { try { Method method = SecurityActions.lookupMethod(stdContext.getClass(), INSTANCE_MANAGER_SETTER_NAME, InstanceManager.class); SecurityActions.ensureAccessible(method); try { method.invoke(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorInvokingMethod(method.getName(), stdContext, instanceManager); } } catch (NoSuchMethodException e1) { // Getter/setter not found } try { Field field = SecurityActions.lookupField(stdContext.getClass(), INSTANCE_MANAGER_FIELD_NAME); SecurityActions.ensureAccessible(field); try { field.set(stdContext, instanceManager); return; } catch (Exception e) { TomcatLogger.LOG.errorWritingField(field.getName(), stdContext, instanceManager); } } catch (NoSuchFieldException e1) { // Field not found } throw TomcatLogger.LOG.neitherFieldNorGetterSetterFound(stdContext.getClass()); }