This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 87045 - BPEL Editor validates BPEL with wrong condition in "IF"
Summary: BPEL Editor validates BPEL with wrong condition in "IF"
Status: RESOLVED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: BPEL Validation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vladimir Yaroslavskiy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-13 00:09 UTC by hemant_bedekar
Modified: 2008-05-05 12:00 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hemant_bedekar 2006-10-13 00:09:05 UTC
BPEL Editor validates BPEL with wrong condition in "IF"

I have a BPEL with the IF operator. For the condition of the IF, I typed "true",
instead of "true()". The BPEL validates successfully and does not complain about
the wrong IF Condition.
Comment 1 Denis Anisimov 2006-10-13 08:27:10 UTC
Do you want to say that "true" is incorrect value as XPath expression ?
If not ( I believe this is correct XPath - this is just literal value ) 
then this issue is incorrect. 
IDE cannot know what you mean when you have wrote "true".
IDE recognize "true" as literal value becuase you wrote this string in this 
manner.

This issue is looks like :
Java code recognize true as boolean type, not as "true()" function.
Comment 2 hemant_bedekar 2006-10-13 18:01:03 UTC
Please keep this ticket open. Below is the email conversation about this - 

----------------------- EMAIL THREAD START -----------------------
<condition>true</condition> does contain a valid XPath expression, so a warning
is all that is called for.

-Ron
-----------------------
Murali Pottlapelli wrote: 

Thanks Ron!
I do not need to investigate! 
As I stated before it is warning, but not an error.  Do you agree?

Regards,
Murali
-----------------------
From: Ronald.Ten-Hove@Sun.COM [mailto:Ronald.Ten-Hove@Sun.COM] 
Sent: Thursday, October 12, 2006 1:47 PM
To: Malkit Bhasin
Cc: Hemant Bedekar; alaska-dev@Sun.COM
Subject: Re: BPEL If operator

Technically, the expression "true" is a valid Boolean expression in XPath 1.0.
There are rules for type conversion in XPath, including conversion to Boolean:

<!--[if !supportLists]-->·         <!--[endif]-->a number is true if and only if
it is neither positive or negative zero nor NaN

<!--[if !supportLists]-->·         <!--[endif]-->a node-set is true if and only
if it is non-empty

<!--[if !supportLists]-->·         <!--[endif]-->a string is true if and only if
its length is non-zero

The condition given (true) is not treated as a string, since it isn't in quotes.
Instead, it is treated as a location path, which results in an empty node set,
which will we converted to a Boolean value of false. 

This sort of thing might we worth warning the user about, since expressions like
<condition>true</condition>, <condition>false</condition>, or
<condition>"false"</condition> all seem like honest mistakes, rather than
location paths. Sounds like a good heuristic for sanity checking Boolean
expressions in XPath, anyway. A good usability enhancement.

-Ron
-----------------------
Malkit Bhasin wrote: 

Yes, this will not work. You need to use boolean function, true() or false().
Did you not use the mapper to set the condition. 

In any case, this should be caught in validation. Can you file a bug in
Issuezilla for this.
-----------------------
From: Hemant Bedekar 
Sent: Thursday, October 12, 2006 12:10 PM
To: Ronald.Ten-Hove@Sun.COM; Malkit Bhasin
Cc: alaska-dev@Sun.COM
Subject: RE: BPEL If operator

Umm, no – because the validation did not fail, I thought this was syntactically
correct ..

BPEL is attached. (look for “If1”)

<if name="If1">
        <condition>true</condition>
        <sequence name="Sequence2">
               <empty name="IF-TRUE"/>
        </sequence>
        <else>
                <empty name="IF-FALSE"/>
        </else>
</if>

Hemant Bedekar
-----------------------
From: Ronald.Ten-Hove@Sun.COM [mailto:Ronald.Ten-Hove@Sun.COM] 
Sent: Thursday, October 12, 2006 12:01 PM
To: Hemant Bedekar
Cc: alaska-dev@Sun.COM
Subject: Re: BPEL If operator

Did you express TRUE as true(), per XPath 1.0?

-Ron
-----------------------
Hemant Bedekar wrote: 

I have an IF operator in my BPEL which I use to follow one branch or another
depending on what I am testing. 

I hard-code the CONDITION to TRUE or FALSE depending on which branch I want the
BPEL to use.

If I set the condition to FALSE, the ELSE path is taken, but if I set condition
to TRUE, umm, again, the ELSE path is taken. Has anybody else seen this?

Hemant Bedekar
----------------------- EMAIL THREAD END -----------------------
Comment 3 Denis Anisimov 2006-10-16 10:52:43 UTC
This is not a bug.
This is even not RFE with such description.

Description should be changed to request for enhancement for
number os situations when IDE could provide some assistance in
situations like this.
Here we can warn user that he has typed POSSIBLY INCORRECT value 
( true -> true() ).
The same sitation with false.
All such assistance situations should be described in some spec.
Such descritpion is RFE.
Comment 4 Sergey Lunegov 2008-05-05 09:06:30 UTC
Vladimir, please look at this.
Comment 5 Vladimir Yaroslavskiy 2008-05-05 12:00:38 UTC
fixed: see error:

XML validation started.

C:/Documents and Settings/v1v/My
Documents/NetBeansProjects/TravelReservationService/TravelReservationService/src/TravelReservationService.bpel:209,12
ERROR: BooleanExpr: Can not resolve a schema context for a relative location path. Expression: "true"

1 Error(s),  0 Warning(s).
XML validation finished.