Re: Bugs in WorkflowQuery
Hani Suleiman <[email protected]>
| Newsgroups | gmane.comp.java.open-symphony.devel |
|---|---|
| Message-ID | <[email protected]> |
Your patches look oddly indented. can you file an issue in jira for
these? Thanks!
On Wednesday, April 30, 2003, at 08:40 AM, Philipp Hug wrote:
> I found some problems in WorkflowQuery and JDBCWorkflowStore:
>
> 1. JDBCWorkflowStore cannot handle queries with null values such as:
> WorkflowQuery(WorkflowQuery.OWNER, WorkflowQuery.CURRENT,
> WorkflowQuery.EQUALS, null)
> this results in a NPE.
>
> Patch: JDBCWorkflowStore.java
> 661c661,665
> < right = value.toString();
> ---
>> if (value != null) {
>> right = "'" + escape(value.toString()) + "'";
>> } else {
>> right = "null";
>> }
> 663c667
> < return left + oper + "'" + escape(right) + "'";
> ---
>> return left + oper + right;
>
>
> 2. recursive queries are handled incorrectly:
> if the root WorkflowQuery object is an AND/OR/XOR query, qtype is set
> to
> zero.
> JDBCWorkflowStore just uses the qtype of the left query:
> if (query.getLeft() != null) {
> qtype = query.getLeft().getType();
> but if this query object is also an AND/OR or XOR query it'll use zero
> as
> qtype and
> it will build a query that searches in the HISTORY_STEPS table.
>
> Patch:
> -> move code from JDBCWorkflStore to WorkflowQuery
> -> do recursive search for qtype instead of just going one level down.
>
> WorkflowQuery
> diff -r1.1 -r1.2
> 17c17
> < * @version $Revision: 1.1 $
> ---
>> * @version $Revision: 1.2 $
> 84c84,95
> < return type;
> ---
>> int qtype = type;
>>
>> if (qtype == 0) { // then not set, so look in sub queries
>> // todo: not sure if you would have a query
>> that
> would look in both old and new, if so, i'll have to change this - TR
>> // but then again, why are there redundant
> tables in the first place? the data model should probably change
>>
>> if (getLeft() != null) {
>> qtype = getLeft().getType();
>> }
>> }
>>
>> return qtype;
>
>
> philipp
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Opensymphony-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf