[kaffe] java.lang.ClassCastException

Jim White jim at pagesmiths.com
Sat Dec 16 08:10:53 PST 2006


Oops.

Jim White wrote:

> Lam King Tin wrote:
> 
>> ...
>> SQL Exception:  Unsupported character encoding 'ISO8859_1'.
>> ...
> 
...
> 
> kaffe-1.0.6/libraries/javalib/kaffe/io/CharToByteConverter.java
> 
> private static CharToByteConverter getConverterInternal(String enc)
> {
> ...
>    String realenc = encodingRoot + ".CharToByte" + 
> ConverterAlias.alias(enc);
> 
> kaffe-1.0.6/libraries/javalib/kaffe/io/ConverterAlias.java
> 
> public class ConverterAlias {
>     private static final Hashtable alias = new Hashtable();
> 
>     // All aliases should be upper case
>     static {
...
>    alias.put("ISO8859_1",     "8859_1");
...

So "ISO8859_1" is an alias known to Kaffe.  So the failure must be when 
it tries to load to the class "kaffe.io.CharToByte8859_1".

That class certainly exists, so I'm thinking that something may have 
gone awry in your classpath.

kaffe-1.0.6/libraries/javalib/kaffe/io/CharToByteConverter.java

private static CharToByteConverter getConverterInternal(String enc)
{
    Class cls = (Class)cache.get(enc);
    if (cls == noConverter) {
       return (null);
    }
    try {
       if (cls == null) {
          String realenc = encodingRoot + ".CharToByte" + 
ConverterAlias.alias(enc);
          cls = Class.forName(realenc);
          cache.put(enc, cls);
       }
       return (CharToByteConverter)cls.newInstance();
    }


You should turn on the verbose option to Kaffe so you can confirm that 
"kaffe.io.CharToByteConverter" is able to load 
"kaffe.io.CharToByte8859_1".

Also you can run a test case for:

byte[] foo = "abc".getBytes("ISO8859_1");

Jim





More information about the kaffe mailing list