Re: Using reflection to call tcnative methods

2011-07-09 Thread Christopher Schultz
Mladen,

On 7/8/2011 11:44 PM, Mladen Turk wrote:
 On 07/09/2011 04:14 AM, Christopher Schultz wrote:
 All,

 I've been working in AprLifecycleListener to add FIPS support. I need to
 make an additional native method call in initializeSSL and I'm wondering
 why all of the native methods are called using reflection instead of
 direct method calls.

 
 Think that originates from the initial code when the java part of
 native was not part of tomcat code.
 We needed a way to make (at that time a separate .jar) tomcat uses
 it without run time dependency.

That makes sense.

 If there's no good reason, then all the reflective-call clutter should
 be removed.

 
 +1.
 There is absolutely no reason to use the reflection any more.

Okay. I have a patch I'd like to make that should be as small as
possible in general, so I think I shouldn't change the existing
reflective calls, at least not in this patch.

Should I therefore code my patch to match the existing code (using
reflection) and then write another patch to remove the reflection, or
should my initial patch just avoid the reflection and the code will have
two different calling strategies until both patches are applied?

(I'm more concerned with backporting to TC 6 than my initial patches
which are of course targeted towards TC 7).

I'll wait for another opinion or two before I make any commits.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


Using reflection to call tcnative methods

2011-07-08 Thread Christopher Schultz
All,

I've been working in AprLifecycleListener to add FIPS support. I need to
make an additional native method call in initializeSSL and I'm wondering
why all of the native methods are called using reflection instead of
direct method calls.

The SSL class, for instance, and the AprLifecycleListener are both in
the Tomcat source tree and so they should always be in sync.

The only reason I can think of is that native methods can throw any
exception they want even if they are not declared in the Java stub, and
the InvocationTargetException that wraps any exception through a
reflective call will help avoid any problems. Is that it?

Is that the reason for the reflective calls?

If not, is there another reason?

If there's no good reason, then all the reflective-call clutter should
be removed.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


Re: Using reflection to call tcnative methods

2011-07-08 Thread Mladen Turk

On 07/09/2011 04:14 AM, Christopher Schultz wrote:

All,

I've been working in AprLifecycleListener to add FIPS support. I need to
make an additional native method call in initializeSSL and I'm wondering
why all of the native methods are called using reflection instead of
direct method calls.



Think that originates from the initial code when the java part of
native was not part of tomcat code.
We needed a way to make (at that time a separate .jar) tomcat uses
it without run time dependency.



If there's no good reason, then all the reflective-call clutter should
be removed.



+1.
There is absolutely no reason to use the reflection any more.



Regards
--
^TM

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org