Hi,

I am trying to map a field being an object of a very specific class (enum wrapper) by 
using my own handler. I am getting a strange exception all the time. As usual - please 
heeeeelp ;-)

Here is the mapping:
        <field name="cnxflag" type="other" direct="true" handler="EnumHandler" 
verify-constructable="false">
                <bind-xml name="cnxflag" node="element"/>
        </field>

I am getting an exception upon execution of:                    
        ...
        Mapping mapping = new Mapping();
        mapping.loadMapping("castorMapping.xml");
        ...
        //create marshaller
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setMapping(mapping); // <- here

The exception looks like this:

        toString: org.exolab.castor.mapping.MappingException: Nested error:     
org.exolab.castor.mapping.MappingException: The field public FSE_SVC.ConnectionFlag    
 FSE_SVC.AvlSolution1.cnxflag is not of the specified type [C
        Stack trace:
        org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:294)
        org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:246)
        org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:523)
        castorTest.testAvlSolution1(castorTest.java:59)
        castorTest.main(castorTest.java:27)

By the way - when I was using the O2XMapper, I noticed that it was handling char[] and 
char[][] incorrectly, setting the type attribute to "[C" and "[[C" respectivly. This 
looks similar, so maybe this is the problem?

I tried to debug CASTOR, but without knowing the idea of its operation I got nowhere...

The class of the field being the problem looks like this:
public class ConnectionFlag implements org.omg.CORBA.portable.IDLEntity
{
  private        int __value;
  private static int __size = 4;
  private static FSE_SVC.ConnectionFlag[] __array = new FSE_SVC.ConnectionFlag 
[__size];

  public static final int _NeedsNoConnection = 0;
  public static final FSE_SVC.ConnectionFlag NeedsNoConnection = new 
FSE_SVC.ConnectionFlag(_NeedsNoConnection);
  public static final int _NeedsConnection = 1;
  public static final FSE_SVC.ConnectionFlag NeedsConnection = new 
FSE_SVC.ConnectionFlag(_NeedsConnection);
  public static final int _NeedsOriginConnection = 2;
  public static final FSE_SVC.ConnectionFlag NeedsOriginConnection = new 
FSE_SVC.ConnectionFlag(_NeedsOriginConnection);
  public static final int _NeedsDestinationConnection = 3;
  public static final FSE_SVC.ConnectionFlag NeedsDestinationConnection = new 
FSE_SVC.ConnectionFlag(_NeedsDestinationConnection);

  public int value ()
  {
    return __value;
  }

  public static FSE_SVC.ConnectionFlag from_int (int value)
  {
    if (value >= 0 && value < __size)
      return __array[value];
    else
      throw new org.omg.CORBA.BAD_PARAM ();
  }

  protected ConnectionFlag (int value)
  {
    __value = value;
    __array[__value] = this;
  }
} // class ConnectionFlag

Thanks, 

Michal Grzemowski 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to