Keith,
No, I am certain that I updated from the top of the tree. To be absolutely
sure, I updated again from the top, reset all sticky tags, cleaned and did a
full rebuild. The problem remains. I'm not sure why you aren't having this
problem, but I have located the bug:
The null pointer exception occurs on the last line of this section of
SourceFactory.java, which is responsible for documenting the
"notifyPropertyChangeListeners" method:
***
JDocComment jdc = jMethod.getJDocComment();
JDocDescriptor jdDesc = null;
jdc.appendComment(desc);
jMethod.addParameter(new JParameter(SGTypes.String, "fieldName"));
jdDesc = jdc.getParamDescriptor("fieldName");
jdDesc.setDescription("the name of the property that has changed.");
***
In other words, the parameter descriptor returned from the JDocComment jdc
is null. I checked out revision 1.9 and 1.10 of JMethod.java to determine
why the JDocComment returned from JMethod would be returning a null
descriptor in this case.
In revision 1.9 of JMethod.java, in addParameter(JParameter), this line
appears:
//-- create comment
jdc.addDescriptor(JDocDescriptor.createParamDesc(pName, null));
In revision 1.10 of JMethod.java (the latest), this line does not appear.
In fact, "addDescriptor" does not appear anywhere in JMethod.java. The new
JMethod *does* call addParameter in JMethodSignature, which calls
addDescriptor on its private JDocComment, but as you wll notice on the first
line of the code snippet above, it is the JDocComment that is returned from
JMethod, NOT JMethodSignature, that is being asked to return a descriptor in
SourceFactory. To fix this, JMethodSignature and JMethod need to use the
same JDocComment instance, or SourceFactory needs to get the JDocComment
from JMethodSignature instead of JMethod.
Jeff
> -----Original Message-----
> From: Keith Visco [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 7:07 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Source generation broken in latest CVS
>
>
>
> Hi Jeff,
>
> You below Schema works just fine for me. Looks like you have a
> synchronization issue with our CVS server. Try doing an update from the
> top of the tree...the package org.exolab.javasource package had some
> changes a few days ago.
>
> It looks like you did an update from "org/exolab/castor" instead and you
> didn't get the changes to the javasource package.
>
> --Keith
>
>
> Jeff Norris wrote:
> >
> > All source generator functions seem to be broken in the latest
> Castor CVS
> > version. I rolled back my CVS to 3/27/2002 and the problems went away.
> > With the latest version in the CVS, I get this error on even the most
> > trivial of schemas:
> >
> > ***
> > Exception in thread "main" java.lang.NullPointerException
> > at
> >
> org.exolab.castor.builder.SourceFactory.createPropertyChangeMethod
> s(SourceFa
> > ctory.java:856)
> > at
> >
> org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFac
> tory.java:
> > 345)
> > at
> >
> org.exolab.castor.builder.SourceGenerator.createClasses(SourceGene
> rator.java
> > :781)
> > at
> >
> org.exolab.castor.builder.SourceGenerator.createClasses(SourceGene
> rator.java
> > :726)
> > at
> >
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGen
> erator.jav
> > a:361)
> > at
> >
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGen
> erator.jav
> > a:419)
> > at
> >
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGen
> erator.jav
> > a:448)
> > at
> > org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:672)
> > ***
> >
> > Here is the schema I used as a test case:
> >
> > ***
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:element name="root">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element name="Foo" type="xs:string"/>
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> > ***
> >
> > And finally, here are all of the files from the xml package that were
> > updated in my last "cvs update", so the problem is almost
> certainly in one
> > of these:
> >
> > ***
> > P castor/src/main/org/exolab/castor/xml/Introspector.java
> > P castor/src/main/org/exolab/castor/xml/schema/ComplexType.java
> > P castor/src/main/org/exolab/castor/xml/schema/ElementDecl.java
> > U castor/src/main/org/exolab/castor/xml/schema/Group.java
> > P castor/src/main/org/exolab/castor/xml/schema/Schema.java
> > P castor/src/main/org/exolab/castor/xml/schema/SimpleType.java
> > P castor/src/main/org/exolab/castor/xml/schema/TypeReference.java
> > P castor/src/main/org/exolab/castor/xml/schema/XMLType.java
> > P castor/src/main/org/exolab/castor/xml/schema/reader/SchemaReader.java
> > ***
> >
> > Jeff
> >
> > -----------------------------------------------------------
> > 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