You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Chris Wall <ch...@gmail.com> on 2006/08/30 23:12:10 UTC

tuscany-sdo-plugin produces NPE

Hi.  Within the EPackageImpl implementing class generated by
tuscany-sdo-plugin, the init() method calls a method on an instance of
itself before the instance is initialized.  For example:

<snippet>

  public static MedRecWebServicesPackageImpl init()
  {
    if (isInited) return
(MedRecWebServicesPackageImpl)EPackage.Registry.INSTANCE.getEPackage(
MedRecWebServicesPackageImpl.eNS_URI);

    // Obtain or create and register package
    MedRecWebServicesPackageImpl theMedRecWebServicesPackageImpl =
(MedRecWebServicesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI)
instanceof MedRecWebServicesPackageImpl ?
EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new
MedRecWebServicesPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    MedRecWebServicesPackageImpl.eINSTANCE.eClass();  <---- P R O D U C E
S   N P E
    SDOPackageImpl.eINSTANCE.eClass();
    ModelPackageImpl.eINSTANCE.eClass();

</snippet>

The eClass() method needs to be called on theMedRecWebServicesPackageImpl,
called later in the process once eINSTANCE is initialized, or eINSTANCE
needs to not be declared final.

Thanks.

-Chris

Re: tuscany-sdo-plugin produces NPE

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Chris,

This does look quite strange. My guess is that either the schema that this 
is generated from is invalid, causing the generator to generate this weird 
init method, or there's a subtle bug in the generator that the schema is 
bringing out. Either way, it would be good if you could provide us with 
the schema, or a test schema that has the same effect on the init method.

Thanks,
Frank.

"Raymond Feng" <en...@gmail.com> wrote on 08/30/2006 05:40:13 PM:

> Hi, Chris,
> 
> Usually MedRecWebServicesPackageImpl.eINSTANCE.eClass() should not be 
called 
> in MedRecWebServicesPackageImpl.init() method. It seems to be a 
> code-generation issue. Frank, Fuwei or Yang, any idea?
> 
> Thanks,
> Raymond
> 
> ----- Original Message ----- 
> From: "Chris Wall" <ch...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Wednesday, August 30, 2006 2:12 PM
> Subject: tuscany-sdo-plugin produces NPE
> 
> 
> > Hi.  Within the EPackageImpl implementing class generated by
> > tuscany-sdo-plugin, the init() method calls a method on an instance of
> > itself before the instance is initialized.  For example:
> >
> > <snippet>
> >
> >  public static MedRecWebServicesPackageImpl init()
> >  {
> >    if (isInited) return
> > (MedRecWebServicesPackageImpl)EPackage.Registry.INSTANCE.getEPackage(
> > MedRecWebServicesPackageImpl.eNS_URI);
> >
> >    // Obtain or create and register package
> >    MedRecWebServicesPackageImpl theMedRecWebServicesPackageImpl =
> > (MedRecWebServicesPackageImpl)(EPackage.Registry.INSTANCE.
> getEPackage(eNS_URI)
> > instanceof MedRecWebServicesPackageImpl ?
> > EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new
> > MedRecWebServicesPackageImpl());
> >
> >    isInited = true;
> >
> >    // Initialize simple dependencies
> >    MedRecWebServicesPackageImpl.eINSTANCE.eClass();  <---- P R O D U C 
E
> > S   N P E
> >    SDOPackageImpl.eINSTANCE.eClass();
> >    ModelPackageImpl.eINSTANCE.eClass();
> >
> > </snippet>
> >
> > The eClass() method needs to be called on 
theMedRecWebServicesPackageImpl,
> > called later in the process once eINSTANCE is initialized, or 
eINSTANCE
> > needs to not be declared final.
> >
> > Thanks.
> >
> > -Chris
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: tuscany-sdo-plugin produces NPE

Posted by Raymond Feng <en...@gmail.com>.
Hi, Chris,

Usually MedRecWebServicesPackageImpl.eINSTANCE.eClass() should not be called 
in MedRecWebServicesPackageImpl.init() method. It seems to be a 
code-generation issue. Frank, Fuwei or Yang, any idea?

Thanks,
Raymond

----- Original Message ----- 
From: "Chris Wall" <ch...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Wednesday, August 30, 2006 2:12 PM
Subject: tuscany-sdo-plugin produces NPE


> Hi.  Within the EPackageImpl implementing class generated by
> tuscany-sdo-plugin, the init() method calls a method on an instance of
> itself before the instance is initialized.  For example:
>
> <snippet>
>
>  public static MedRecWebServicesPackageImpl init()
>  {
>    if (isInited) return
> (MedRecWebServicesPackageImpl)EPackage.Registry.INSTANCE.getEPackage(
> MedRecWebServicesPackageImpl.eNS_URI);
>
>    // Obtain or create and register package
>    MedRecWebServicesPackageImpl theMedRecWebServicesPackageImpl =
> (MedRecWebServicesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI)
> instanceof MedRecWebServicesPackageImpl ?
> EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new
> MedRecWebServicesPackageImpl());
>
>    isInited = true;
>
>    // Initialize simple dependencies
>    MedRecWebServicesPackageImpl.eINSTANCE.eClass();  <---- P R O D U C E
> S   N P E
>    SDOPackageImpl.eINSTANCE.eClass();
>    ModelPackageImpl.eINSTANCE.eClass();
>
> </snippet>
>
> The eClass() method needs to be called on theMedRecWebServicesPackageImpl,
> called later in the process once eINSTANCE is initialized, or eINSTANCE
> needs to not be declared final.
>
> Thanks.
>
> -Chris
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org