Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

exception classes/stubs

0 views
Skip to first unread message

Rob Martin

unread,
Dec 11, 2002, 12:43:22 AM12/11/02
to
Greetings

We're getting errors in our JSP compiles "ambiguous class:
package1.exc_norowsfound and package2.exc_norowsfound" etc. We have a common
PB library that all packages use - ancestors etc. We've put in there some
common exception objects (e.g. exc_norowsfound and
exc_mandatoryfieldmissing). When we generate stubs for the components, it
generates the class files for the exceptions in that package - and each
package.

Trouble is, we have a JSP page that calls a component in each of the two
packages, so we have import statements at the top of the JSP file to import
package1.* and package2.* - to import the stubs (and exception). There's the
issue and hence the error; there's two classes of the same name; the common
exception we put in our common PBL !

So, how does one do this (common exception object in a common ancestor PBL)?
Should you not, and have different names for all your exceptions?

Thoughts appreciated!
Regs
Rob


Andrew Stevens

unread,
Dec 11, 2002, 6:05:22 AM12/11/02
to
On Wed, 11 Dec 2002 16:43:22 +1100,
in sybase.public.easerver.general

Rob Martin <som...@microsoft.com> wrote:
>Trouble is, we have a JSP page that calls a component in each of the two
>packages, so we have import statements at the top of the JSP file to import
>package1.* and package2.* - to import the stubs (and exception). There's the
>issue and hence the error; there's two classes of the same name; the common
>exception we put in our common PBL !

Why not import the classes you use from those packages individually, instead of
using the .* form, and only import the exception from the package that's
relevant?

If you do need to use the exception from both packages (e.g. you're calling
components in both packages and their interfaces each say they throw the one
from their package) then don't import either exception and use the fully
qualified names insead. Make sure you catch the right one each time or you'll
probably get ClassCastExceptions.


Andrew.

Rob Martin

unread,
Dec 11, 2002, 3:00:27 PM12/11/02
to
Thanks Andrew, looks like the way to go. There was a reason we had *, we had
an include file that has all the std imports, reason was is that can be for
different environments (e.g. package1_dev.* or package_prod.* - for many
versions on the same jaguar) so we only had to change one include file, not
the jsp's. We'll sort it as you mention.

Regs
Rob

"Andrew Stevens" <at...@hotmail.com> wrote in message
news:fJEAzUQ...@forums.sybase.com...

Mark Pfeifer[TeamSybase]

unread,
Dec 11, 2002, 8:53:26 PM12/11/02
to
In article <NmpQZqN...@forums.sybase.com>, som...@microsoft.com
says...

> packages, so we have import statements at the top of the JSP file to import
> package1.* and package2.* - to import the stubs (and exception). There's the
> issue and hence the error; there's two classes of the same name; the common
> exception we put in our common PBL !

You already knows this but I never recommend doing the .* technique.
Can only cause you issues - as you found. Just a lazy way out<g>

Mark

0 new messages