Hi Oleg, > Hi Roland, > I think it would be prudent on our part to differentiate unsupported > charsets from illegal ones and treat them differently. So, I just > tweaked the test case to use a legal charset name, instead of making > EncodingUtils catch all runtime exceptions. > > Generally I think this is a very bad practice to catch runtime > exceptions indiscriminately, because you may well end up catching NPE > and OutOfMemory exceptions as well, which to me should clearly be fatal > and should result in the termination of the process (thread)
Generally, I agree with you. But in this particular case, the catch is used to fall back to a default charset if the one from the entity can not be used. It's a "best effort" to convert bytes to a string, using or not using a charset most likely received from a server. I don't think that users will appreciate different behavior, depending on whether the useless charset from the server is considered "unknown" or "illegal" by the JVM on which the code is running. OutOfMemory is an Error, not an Exception. No problem with that :-) cheers, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
