You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2007/06/11 16:51:21 UTC
svn commit: r546164 -
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
Author: deepal
Date: Mon Jun 11 07:51:20 2007
New Revision: 546164
URL: http://svn.apache.org/viewvc?view=rev&rev=546164
Log:
fixing AXIS2-2785
(rather than throwing exception we just ignore unwanted exception)
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java?view=diff&rev=546164&r1=546163&r2=546164
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Mon Jun 11 07:51:20 2007
@@ -44,26 +44,29 @@
public static void initServiceClass(Object obj,
ServiceContext serviceContext) {
+ Class classToLoad = obj.getClass();
+ // We can not call classToLoad.getDeclaredMethed() , since there
+ // can be insatnce where mutiple services extends using one class
+ // just for init and other reflection methods
+ Method method =
+ null;
try {
- Class classToLoad = obj.getClass();
- // We can not call classToLoad.getDeclaredMethed() , since there
- // can be insatnce where mutiple services extends using one class
- // just for init and other reflection methods
- Method method =
- classToLoad.getMethod(SERVICE_INIT_METHOD, new Class[]{ServiceContext.class});
- if (method != null) {
+ method = classToLoad.getMethod(SERVICE_INIT_METHOD, new Class[]{ServiceContext.class});
+ } catch (Exception e) {
+ //We do not need to inform this to user , since this something
+ // Axis2 is checking to support Session. So if the method is
+ // not there we should ignore that
+ }
+ if (method != null) {
+ try {
method.invoke(obj, new Object[]{serviceContext});
+ } catch (IllegalAccessException e) {
+ log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
+ } catch (IllegalArgumentException e) {
+ log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
+ } catch (InvocationTargetException e) {
+ log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
}
- } catch (SecurityException e) {
- log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
- } catch (IllegalArgumentException e) {
- log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
- } catch (IllegalAccessException e) {
- log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
- } catch (InvocationTargetException e) {
- log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
- } catch (NoSuchMethodException e) {
- log.debug("Exception trying to call " + SERVICE_INIT_METHOD, e);
}
}
@@ -103,33 +106,29 @@
public static void destroyServiceObject(ServiceContext serviceContext) {
- try {
- Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
- if (obj != null) {
- Class classToLoad = obj.getClass();
-
- // We can not call classToLoad.getDeclaredMethed() , since there
- // can be insatnce where mutiple services extends using one class
- // just for init and other reflection methods
- Method[] methods = classToLoad.getMethods();
-
- for (int i = 0; i < methods.length; i++) {
- if (SERVICE_DESTROY_METHOD.equals(methods[i].getName())
- && (methods[i].getParameterTypes().length == 1)
- && (methods[i].getParameterTypes()[0] == ServiceContext.class)) {
- methods[i].invoke(obj, new Object[]{serviceContext});
- break;
- }
+ Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
+ if (obj != null) {
+ Class classToLoad = obj.getClass();
+ Method method =
+ null;
+ try {
+ method = classToLoad.getMethod(SERVICE_DESTROY_METHOD, new Class[]{ServiceContext.class});
+ } catch (NoSuchMethodException e) {
+ //We do not need to inform this to user , since this something
+ // Axis2 is checking to support Session. So if the method is
+ // not there we should ignore that
+ }
+
+ if(method!=null){
+ try {
+ method.invoke(obj, new Object[]{serviceContext});
+ } catch (IllegalAccessException e) {
+ log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
+ } catch (InvocationTargetException e) {
+ log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
}
}
- } catch (SecurityException e) {
- log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
- } catch (IllegalArgumentException e) {
- log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
- } catch (IllegalAccessException e) {
- log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
- } catch (InvocationTargetException e) {
- log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
+
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org