Well, I'll freely admit that I'm not a plugin expert, but I would guess that
the NullPointerException is being thrown because getFirstElementByPath is
returning null. So:
MbElement element = assembly
.getGlobalEnvironment()
.getRootElement()
.getFirstElementByPath("/Environment/Variables");
if (null != element)
{
if element.getName().equals("Variables")
{
... do something
}
}
else
{
... complain
}
If that's not the problem, then a print of the exception traceback would
pin-point where it was going wrong.
Dave
-----Original Message-----
From: MQSeries List [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 23 June 2005 10:54
To: [email protected]
Subject: How to check in a plugin node if an element in a tree exists?
Unfortunately IBM is not describing what happens when calling the method
getFirstElementByPath("/Environment/Variables") and the field Variables does
not exist.
I tried to do the following:
if ( assembly
.getGlobalEnvironment()
.getRootElement()
.getFirstElementByPath("/Environment/Variables")
.getName().equals("Variables")
)
but got a JavaNullPointerException in the catch path of the flow using this
construct in a plugin node.
Is there a better way to test if a field exists or is my statement wrong?
Many thanks for your support
Regards
Markus
------------------------------------------------------------------
Dr. Markus Sonderegger, IKI
Bank Julius Baer & Co. Ltd.
Hohlstrasse 602, CH-8010 Zurich, Switzerland Telephone +41 58 887 7281, Fax
+41 58 887 4475 www.juliusbaer.com
------------------------------------------------------------------
*****Disclaimer*****
This message is for the addressee only and may contain confidential or
privileged information. You must delete and not use it if you are not the
intended recipient. It may not be secure or error-free. All e-mail
communications to and from the Julius Baer Group may be monitored.
Processing of incoming e-mails cannot be guaranteed. Any views expressed in
this message are those of the individual sender. This message is for
information purposes only. All liability of the Julius Baer Group and its
entities for any damages resulting from e-mail use is excluded. US persons
are kindly requested to read the important legal information presented at
following URL: http://www.juliusbaer.com/maildisclaimer
Instructions for managing your mailing list subscription are provided in the
Listserv General Users Guide available at http://www.lsoft.com
Archive: http://listserv.meduniwien.ac.at/archives/mqser-l.html
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://listserv.meduniwien.ac.at/archives/mqser-l.html