You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Hontvari Jozsef <ho...@solware.com> on 2003/05/20 23:29:24 UTC

[PATCH] subject normalization in GenericListserv / 3

I have attached a patch which ensures that the reflection is only executed
once, at the time of the class initialization.

It also enhances the heuristic a bit, it considers the case when the first
words were not encoded, only the next ones.


----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Tuesday, May 20, 2003 12:13 AM
Subject: RE: [PATCH] subject normalization in GenericListserv


> I've merged this patch into the CVS, both HEAD and version 2.
>
> Regarding your thoughts for the future:
>
> > enhancement ideas (just for the record):
> >   - better heuristic: if it cannot determine the original
> >     charset from the raw header, it can also look for the
> >     body charset if it is available.
>
> I would not presume to use the encoding from another body part.
>
> >   - (clarification) if the _decoded_ header value is ASCII
> >     only then the charset is definitely ASCII. However this
> >     doesn't mean that the new value will only contain ASCII
> >     chars (the prefix can contain anything). So some charset
> >     heuristic may be still useful.
>
> Unless we come up with a scheme to provide prefix encoding, you probably
> need to assume that the prefix is ASCII.
>
> >   - under java 1.4 java.nio the system can determine if the
> >     original charset fits or not (if there is untranslatable
> >     characters). If the charset doesn't fit the new value, it
> >     can fall back to UTF-8.
>
> OK, but would you look at something?  The code currently determines JDK
1.4
> or not at runtime for each operation.  Since it is, shall we say, "highly
> unlikely" that the JDK would change during execution, perhaps we should
> cache the JDK status once, and then use conditional logic?  Having to
> reflect each time, and catch the exception, is time consuming.
>
> FWIW, when compiling for release, I always compile the code with JDK 1.3.
I
> use JDK 1.4 for the javadocs because JDK 1.3 can't compile them, but the
> binaries are built with JDK 1.3 to ensure compatibility.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>

RE: [PATCH] subject normalization in GenericListserv / 3

Posted by "Noel J. Bergman" <no...@devtech.com>.
ROFL!  Nice job, sir.  :-)   I am laughing because I was just going to post
to you almost word for word the same code for doing the JDK 1.4 detection:

	private static java.lang.reflect.Method getByAddress = null;

	static {
		try {
			Class inetAddressClass = Class.forName("java.net.InetAddress");
			Class[] parameterTypes = { byte[].class };
			getByAddress = inetAddressClass.getMethod("getByAddress",
parameterTypes);
		} catch (Exception e) {
			getByAddress = null;
		}
	}

That is in some code I'm going to post later tonight.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org