|
Hi David,
I was going to send two cliched ( but true, that's why they are
cliches ) quotes and leave it at that:
"It *should* work like ( something ) but it depends on what the
programmer was thinking that day."
"More design occurs during coding than any of us would like to admit."
Either or both may apply, but I think there's more to it than that.
Short version: I think the boolean and the exception refer to two distinctly
different things.
I'm not psychic, but here's my take after looking at the code, which is:
public boolean exists()
throws AS400Exception,
AS400SecurityException,
ErrorCompletingRequestException,
InterruptedException,
IOException,
ObjectDoesNotExistException
{
try
{
refresh();
}
catch(AS400Exception e)
{
String id = e.getAS400Message().getID().trim();
if (id.equalsIgnoreCase("CPF9801") ||
id.equalsIgnoreCase("CPF9810"))
{
return false;
}
throw e;
}
return true;
}
If you don't remember immediately, here are the messages:
CPF9801: Object &2 in library &3 not found.
CPF9810: Library &1 not found.
Note that exists() calls refresh() - which throws
ObjectDoesNotExistException - which calls another method - which also
throws ObjectDoesNotExistException. Also, there is a difference between an
object under OS/400 ( pgm, file, lib, etc. ) and a Java object.
exists() returns false if the library and/or OS/400 object wasn't found
( the point of the method ) and throws ObjectDoesNotExistException if some
necessary Java object couldn't be located or created along the way in the
chain of method calls ( i.e. a problem occurred )
Other interpretations welcome.
Joe Sam
Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400
----- Original Message -----
From: "David Gibbs" <david@xxxxxxxxxxxx>
To: <java400-l@xxxxxxxxxxxx>
Sent: Wednesday, June 15, 2005 11:50 AM
Subject: ObjectDescription exists method?
> Anyone know why the exists() method in
> com.ibm.as400.access.ObjectDescription would throw a
> ObjectDoesNotExistException?
>
> Seems kind of redundant to me.
>
> david
>
> --
> David Gibbs
> david@xxxxxxxxxxxx
>
> Receipt of this message does not grant you permission to send me
> Unsolicited Commercial Email
>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.