// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package gravity.impl;

import gravity.ProxyableComponent;
import gravity.WrapperException;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author Harish Krishnaswamy
 * @version $Id: JdkComponentInvocationHandler.java,v 1.3 2004-05-18 20:52:03 harishkswamy Exp $
 */
public class JdkComponentInvocationHandler extends AbstractComponentInvocationHandler implements
    InvocationHandler
{
    public JdkComponentInvocationHandler(ProxyableComponent comp)
    {
        super(comp);
    }

    public Object invoke(Object proxy, Method method, Object[] args)
    {
        Object instance = getConcreteComponentInstance();

        try
        {
            return method.invoke(instance, args);
        }
        catch (Exception e)
        {
            throw WrapperException.wrap(e, "Unable to invoke method: " + method + " on component: "
                + _component);
        }
    }
}
@@ -737,16 +737,68 @@
 andler;%0A
+import java.lang.reflect.InvocationTargetException;%0A
 import j
@@ -914,17 +914,17 @@
 ava,v 1.
-3
+4
  2004-05
@@ -928,19 +928,19 @@
 -05-
-18 20:52:03
+27 21:01:07
  har
@@ -1411,16 +1411,84 @@
  catch (
+Throwable t)%0A        %7B%0A            if (t instanceof InvocationTarget
 Exceptio
@@ -1488,18 +1488,16 @@
 xception
- e
 )%0A      
@@ -1490,33 +1490,98 @@
 eption)%0A        
-%7B
+        t = ((InvocationTargetException) t).getTargetException();%0A
 %0A            thr
@@ -1605,17 +1605,17 @@
 on.wrap(
-e
+t
 , %22Unabl

Handle InvocationTargetException appropriately.