It's line 837 for me...I did a CVS update directly before I sent you the
mail, so I don't think you are using the CVS version of that file.

In anycase...I'll take a look into it because I do get an NPE at line
837 when running your test case.

--Keith


"Mark A. Sellers" wrote:
> 
> In my editor, the Marshaller.java class (which I downloaded from the CVS
> link) line 672 is:
> 
> name = classDesc.getXMLName();
> 
> ??????????
> 
> > -----Original Message-----
> > From: Keith Visco [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 23, 2002 12:22 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [castor-dev] How do I marshall a collection of my class
> > objects?
> >
> >
> >
> > Hi Mark,
> >
> > I'll take a look into it. However, your stacktrace cannot come from the
> > CVS version of Castor...line 672 of Marshaller in the CVS cannot
> > possibly throw an exception:
> >
> > 672:      if (object == null)
> >
> > In any case, I'll try out your example and see what I get.
> >
> > Thanks,
> >
> > --Keith
> >
> > "Mark A. Sellers" wrote:
> > >
> > > I tried using the CVS version and still get an NPE exception.
> > Here's what
> > > I'm doing:
> > >
> > > package rm.castor;
> > >
> > > import java.util.Date;
> > > import java.util.*;
> > > import java.sql.Timestamp;
> > > import java.awt.*;
> > > import java.awt.event.*;
> > > import java.io.*;
> > > import org.exolab.castor.xml.*;
> > > import TestObject;
> > > import org.xml.sax.ContentHandler;
> > > import org.apache.xml.serialize.*;
> > >
> > > class Castor extends Frame {
> > >
> > >         public Castor() {
> > >                 addWindowListener(new WindowAdapter() {
> > >                         public void windowClosing(WindowEvent e) {
> > >                                 dispose();
> > >                                 System.exit(0);
> > >                         }
> > >                 });
> > >         }
> > >
> > >         public static void main(String args[]) {
> > >                 System.out.println("Starting Castor...");
> > >                 Castor mainFrame = new Castor();
> > >                 mainFrame.setSize(400, 400);
> > >                 mainFrame.setTitle("Castor");
> > >                 mainFrame.setVisible(true);
> > >
> > >     TestObject[] to = new TestObject[2];
> > >     to[0] = new TestObject();
> > >     to[0].setDateOfBirth(new java.util.Date("10/1/2001"));
> > >     to[0].setName("Mark");
> > >     to[1] = new TestObject();
> > >     to[1].setDateOfBirth(new java.util.Date("12/21/1956"));
> > >     to[1].setName("Sandy");
> > >
> > >   try {
> > >         FileWriter writer = new FileWriter("C:\\Castor\\cc.xml");
> > >         Marshaller mm = new Marshaller(writer);
> > >       mm.setNamespaceMapping("-//EXOLAB/Castor Object Mapping
> > Schema Version
> > > 1.0//EN","http://castor.exolab.org/mapping.xsd";);
> > >       mm.setMarshalAsDocument(true);
> > >         mm.setValidation(false);
> > >         mm.setNSPrefixAtRoot(true);
> > >
> > >         mm.marshal(to, writer);
> > >
> > >         System.err.println("finished marshalling...");
> > >
> > >    } catch (java.io.IOException ioe) {
> > >        System.err.println(ioe.toString());
> > >    } catch ( org.exolab.castor.xml.MarshalException me ) {
> > >         System.err.println(me.toString());
> > >    } catch ( org.exolab.castor.xml.ValidationException ve ) {
> > >         System.err.println(ve.toString());
> > >    }
> > >   }
> > > }
> > >
> > > Class TestObject:
> > >
> > > import java.util.Date;
> > > public class TestObject implements java.io.Serializable {
> > >    private String name = null;
> > >    private Date dob = null;
> > >
> > >    public TestObject() {
> > >       super();
> > >    }
> > >
> > >    public TestObject(String name) {
> > >       this.name  = name;
> > >    }
> > >
> > >    public Date getDateOfBirth() {
> > >       return dob;
> > >    }
> > >
> > >    public String getName() {
> > >       return name;
> > >    }
> > >
> > >    public void setDateOfBirth(Date dob) {
> > >       this.dob = dob;
> > >    }
> > >
> > >    public void setName(String name) {
> > >       this.name = name;
> > >    }
> > > }
> > >
> > > Exception in thread "main" java.lang.NullPointerException
> > >         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:672)
> > >         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:540)
> > >         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:460)
> > >         at rm.castor.Castor.main(Castor.java:160)
> > >
> > > Thanks, Mark Sellers
> > >
> > > -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send mail to
> > > [EMAIL PROTECTED] with a subject of:
> > >         unsubscribe castor-dev
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >       unsubscribe castor-dev
> >
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

Reply via email to