Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

assign java classes / (deep) copy - weird error & workaround

2 posts in EJB Client Last posting was on 2004-09-24 09:22:23.0Z
bede Posted on 2004-08-02 15:20:29.0Z
From: "bede" <bedenosp@m.sofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: assign java classes / (deep) copy - weird error & workaround
Lines: 574
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
Message-ID: <410e5bbd@forums-1-dub>
Date: 2 Aug 2004 08:20:29 -0700
X-Trace: forums-1-dub 1091460029 194.7.38.226 (2 Aug 2004 08:20:29 -0700)
X-Original-Trace: 2 Aug 2004 08:20:29 -0700, uu194-7-38-226.unknown.uunet.be
X-Authenticated-User: pbtenbeta
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:326
Article PK: 424501

Hi,

i'm having a problem that i don't fully understand.. was hoping that someone
could shed some light on it.

We use rather complex parameters to communicate to and fro an java EJB. Some
parameters are composed at PB level only, consisting of parts of other
parameters (coming from EJB).

When you try to set this directly ( A.subPar = B.subPar ) like we always did
before, you get a weird error about the datatypes that are being set are
mismatched -see attachment. However both have the same datatype and one of
the datatypes mentioned has nothing to do (not even close!) with the current
script being exectued. It's often a class reference of some other place.

I'm guessing something is wrong with the memory management or so.. garbage
collection, .. whatever..

I've discovered that when you locally declare a variable of the class that's
being assigned from A to B and make the assignment in 2 steps, instead of 1,
it does work properly.

Makes sense to anyone? Should this be reported as a bug?

Thanks,

Ben



Code sample:

java_SofWarning lnv_data[]

java_WorkOrderSessPar lPar

java_SofWarningSessPar lWarningPar

...

//// This generates the MISMATCH error, both parts of the parameter are
arrays of the type java_SofWarning

// lWarningPar.thewarnings = lPar.thesofwarnings


// Workaround

lnv_data[] = lPar.thesofwarnings

lWarningPar.thewarnings = lnv_data[]

SystemError.jpg

Ben (bede) Posted on 2004-09-24 09:22:23.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: assign java classes / (deep) copy - weird error & workaround
Message-ID: <MPG.1bbe0648741c752a9896bf@forums.sybase.com>
References: <410e5bbd@forums-1-dub>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-Trace: 24 Sep 2004 02:22:19 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 63
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 24 Sep 2004 02:22:20 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 24 Sep 2004 02:22:23 -0700
X-Trace: forums-1-dub 1096017743 10.22.108.75 (24 Sep 2004 02:22:23 -0700)
X-Original-Trace: 24 Sep 2004 02:22:23 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:373
Article PK: 424548

In PB-help some possible explanation can be found for this behaviour:
ejbclient java classes are all passed as ANY (see exported proxies) and
use getters and setters to transfer & cast the correct object. PB uses
the generated ejbmappings structure to find out (sequence number-based)
which proxy_class corresponds with which object.
Somehow PB gets confused when setting these directly.. when using a
third ANY class the casting-check will be performed again and mistakes
are avoided.

Ben


In article <410e5bbd@forums-1-dub>, bedenosp@m.sofico.be says...

> Hi,
>
> i'm having a problem that i don't fully understand.. was hoping that someone
> could shed some light on it.
>
> We use rather complex parameters to communicate to and fro an java EJB. Some
> parameters are composed at PB level only, consisting of parts of other
> parameters (coming from EJB).
>
> When you try to set this directly ( A.subPar = B.subPar ) like we always did
> before, you get a weird error about the datatypes that are being set are
> mismatched -see attachment. However both have the same datatype and one of
> the datatypes mentioned has nothing to do (not even close!) with the current
> script being exectued. It's often a class reference of some other place.
>
> I'm guessing something is wrong with the memory management or so.. garbage
> collection, .. whatever..
>
> I've discovered that when you locally declare a variable of the class that's
> being assigned from A to B and make the assignment in 2 steps, instead of 1,
> it does work properly.
>
> Makes sense to anyone? Should this be reported as a bug?
>
> Thanks,
>
> Ben
>
>
>
> Code sample:
>
> java_SofWarning lnv_data[]
>
> java_WorkOrderSessPar lPar
>
> java_SofWarningSessPar lWarningPar
>
> ...
>
> //// This generates the MISMATCH error, both parts of the parameter are
> arrays of the type java_SofWarning
>
> // lWarningPar.thewarnings = lPar.thesofwarnings
>
>
> // Workaround
>
> lnv_data[] = lPar.thesofwarnings
>