NullPointerException when calling getDescription()
Oct 11, 2010
06:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 11, 2010
06:58 PM
NullPointerException when calling getDescription()
During an ECN workflow i have an expression robot to set some wf variables. this is my code snippet
wt.change2.WTChangeOrder2 ecn = (wt.change2.WTChangeOrder2)primaryBusinessObject;
number=ecn.getNumber();
try {
description = ecn.getDescription();
} catch (NullPointerException e) {
description = ";
}
if the description of the ECN is not populated it throws an NullPointerException which i thought I was catching.
Any thoughts?
Labels:
- Labels:
-
Other
5 REPLIES 5
Oct 11, 2010
07:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 11, 2010
07:11 PM
Check the workflow cache directory to make sure that your changes are
compiled. Better yet, delete the cache and restart the server and see if it
still gives the error.
*codebase/wt/workflow/expr*/
Regards,
Prathap <">http://goo.gl/LuT5>
On Mon, Oct 11, 2010 at 3:58 PM, Stephen Drzewiczewski <
-> wrote:
> During an ECN workflow i have an expression robot to set some wf variables.
> this is my code snippet
>
> wt.change2.WTChangeOrder2 ecn =
> (wt.change2.WTChangeOrder2)primaryBusinessObject;
> number=ecn.getNumber();
>
> try {
> description = ecn.getDescription();
> } catch (NullPointerException e) {
> description = ";
> }
>
>
> if the description of the ECN is not populated it throws an
> NullPointerException which i thought I was catching.
>
> Any thoughts?
>
compiled. Better yet, delete the cache and restart the server and see if it
still gives the error.
*codebase/wt/workflow/expr*/
Regards,
Prathap <">http://goo.gl/LuT5>
On Mon, Oct 11, 2010 at 3:58 PM, Stephen Drzewiczewski <
-> wrote:
> During an ECN workflow i have an expression robot to set some wf variables.
> this is my code snippet
>
> wt.change2.WTChangeOrder2 ecn =
> (wt.change2.WTChangeOrder2)primaryBusinessObject;
> number=ecn.getNumber();
>
> try {
> description = ecn.getDescription();
> } catch (NullPointerException e) {
> description = ";
> }
>
>
> if the description of the ECN is not populated it throws an
> NullPointerException which i thought I was catching.
>
> Any thoughts?
>
Oct 11, 2010
08:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 11, 2010
08:07 PM
Ok... a little embarrassed...
I had a test product on my test server that had a copy of the lifecycle
and workflow for that ecn object...
If I had tested my org wf change on any other product it would have
worked as expected. Once I disabled the Product level wf and lifecycle
it obviously started working.
That was moderately annoying!
Thanks Prathap for pointing me to the wf expression directory that
definitely helped and made things click, a little bit.
sd
I had a test product on my test server that had a copy of the lifecycle
and workflow for that ecn object...
If I had tested my org wf change on any other product it would have
worked as expected. Once I disabled the Product level wf and lifecycle
it obviously started working.
That was moderately annoying!
Thanks Prathap for pointing me to the wf expression directory that
definitely helped and made things click, a little bit.
sd
Oct 12, 2010
08:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 12, 2010
08:38 AM
Hi Steve
With your try and catch in place, I don't think ecn.getDescription() will
throw null pointer expression. If ecn is null, then it will throw null
pointer expression.
From few of my clients, I understood the we need to initialize the workflow
variables when the workflows are upgraded from R8 to R91. I am unsure
whether the behavior you notice is relevant to initializing wf variables.
Just a food for thought.
Thank you and have a great time.
Best Regards
Swamy Senthil
Principal Solutions Architect
973 216 0456(M); 973 324 2729(W); 866 908 6561(F)
Work Email: swamy.senthil@swasen.com
LinkedIn Profile:
With your try and catch in place, I don't think ecn.getDescription() will
throw null pointer expression. If ecn is null, then it will throw null
pointer expression.
From few of my clients, I understood the we need to initialize the workflow
variables when the workflows are upgraded from R8 to R91. I am unsure
whether the behavior you notice is relevant to initializing wf variables.
Just a food for thought.
Thank you and have a great time.
Best Regards
Swamy Senthil
Principal Solutions Architect
973 216 0456(M); 973 324 2729(W); 866 908 6561(F)
Work Email: swamy.senthil@swasen.com
LinkedIn Profile:
Oct 12, 2010
08:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 12, 2010
08:53 AM
Instead of a try/catch do this:
description=";
If(ecn != null) {
description = ecn.getDescription();
}
-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
description=";
If(ecn != null) {
description = ecn.getDescription();
}
-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
Oct 12, 2010
09:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 12, 2010
09:39 AM
Thanks for all the replies. The ECN is not what will be null, as it's the PBO for the workflow. It's the description of the ECN which is not required may be null.
Once I disabled the product lifecycle/workflow and the org lifecycle/wf was getting executed, everything behaved as expected.
