Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 918 invoked from network); 11 Jun 2007 14:52:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jun 2007 14:51:58 -0000 Received: (qmail 72233 invoked by uid 500); 11 Jun 2007 14:51:49 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 72061 invoked by uid 500); 11 Jun 2007 14:51:48 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 71948 invoked by uid 500); 11 Jun 2007 14:51:47 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 71941 invoked by uid 99); 11 Jun 2007 14:51:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2007 07:51:47 -0700 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2007 07:51:42 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 144361A981A; Mon, 11 Jun 2007 07:51:22 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r546164 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Date: Mon, 11 Jun 2007 14:51:21 -0000 To: axis2-cvs@ws.apache.org From: deepal@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070611145122.144361A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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