Costin Manolache wrote:
Remy Maucherat wrote:


Tim Funk wrote:

Tomcat5 does not compile with JDK1.3. It does with JDK1.4.

There is only one line of code that prevents it from compiling with
JDK1.3. org.apache.catalina.loader.WebappClassLoader depends on
File.toURI() which does not exist on jdk1.3.

I got around this by the performing the following:
OLD CODE:
 return realFile.toURI().toURL();
NEW CODE
 return new URL("file:" + realFile.toURL().getPath());

My patch also has some spurious stuff because my text editor
automatically strips all trailing whitespace from lines and converts
tabs to spaces. The important stuff is the last 9 lines of the patch
file.
The patch is a bad idea. The change was made to fix RMI related problems.

What should be done is invoke the appropriate methods through
reflection, catching any error (and defaulting to the old code if it
fails).

Well, reflection is a bad idea too :-) A better solution is to use a wrapper like jdkCompat ( i.e. a base class with the 1.3 implementation,
extended with a 1.4 impl ). This class could include other 1.4 methods
and their 1.3 equivalent, if any.
Well, I was planning to implement it as:

try {
// do the nasty 1.4 stuff with reflection
} catch (Throwable t) {
// do the compatible stuff
}

It's not nice but it works (and as the CL is cached, we don't care too much about the performance loss due to the exception).

This would allow implementing the correct stuff, instead of failing.
Sure.

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to