Bug 478116 - MIGRATED_FROM_JIRA: expressions evaluations doesn't work in 0.9.8
Summary: MIGRATED_FROM_JIRA: expressions evaluations doesn't work in 0.9.8
Keywords:
Status: CLOSED EOL
Alias: None
Product: penrose
Classification: Retired
Component: Unknown
Version: 2.0
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Endi Sukma Dewata
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks: 471500
TreeView+ depends on / blocked
 
Reported: 2008-12-27 08:00 UTC by Chandrasekar Kannan
Modified: 2020-03-27 18:33 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 18:33:46 UTC
Embargoed:


Attachments (Terms of Use)

Description Chandrasekar Kannan 2008-12-27 08:00:40 UTC
The following works:
    <at name="cn" rdn="true">
      <expression>slipupi.upi</expression>
    </at>

However, the following, equivalent config, doesn't:
    <at name="cn" rdn="true">
      <expression>return slipupi.upi;</expression>
    </at>

I'll attach more details.


Additional Comments From pigor dated Wed Dec 14 23:27:30 CST 2005 
The penrose.log for the error.

Additional Comments From pigor dated Wed Dec 14 23:41:16 CST 2005 
I tried to debug the problem, and one of the issues seems to be that SearchEngine.searchLocal finds one extra result.

The first one is correct, the second one is empty. I used the following patch to get rid of it:

--- SearchEngine.java.original  2005-12-15 00:38:28.000000000 -0500
+++ SearchEngine.java   2005-12-15 00:38:34.000000000 -0500
@@ -610,7 +610,7 @@
                 parentMapping = partition.getParent(parentMapping);
             }

-            if (parentMapping == null) {
+            if (parentMapping == null && results.size() == 0) {
                 results.add(new AttributeValues());
             }
         }


I don't really know what I'm doing, but the patch seems to  fix the searches when scope=one, and the attributes are a result of an expression. It's still broken for scope=sub.





Additional Comments From endisd dated Thu Jan 26 19:42:05 CST 2006 
There is a problem in the mapping expression. The expression "return slipupi.upi;" will fail if the slipupi object is not present. To avoid the problem, the expression needs to be guarded as follows:

<expression>
  if (slipupi == void || slipupi == null) return null;
  return slipupi.upi;
</expression>

This expression can be shortened as follows:

<variable>slipupi.upi</variable>

If written this way, the code will check the existence of slipupi object first before getting the upi attribute.

The patch did partially fix the problem and has been applied to 0.9.9.



=========================================================
Issue dump from jira
$VAR1 = {
          'priority' => '2',
          'customFieldValues' => [],
          'project' => 'PENROSE',
          'status' => '5',
          'components' => [
                            {}
                          ],
          'attachmentNames' => 'penrose-error-log.txt',
          'reporter' => 'pigor',
          'key' => 'PENROSE-129',
          'assignee' => 'endisd',
          'summary' => 'expressions evaluations doesn't work in 0.9.8',
          'id' => '10351',
          'updated' => '2006-01-26 19:42:05.0',
          'votes' => '0',
          'fixVersions' => [
                           {
                             'releaseDate' => '2006-01-24 00:00:00.0',
                             'sequence' => '9',
                             'name' => 'Penrose-0.9.9',
                             'released' => 'true',
                             'id' => '10040',
                             'archived' => 'false'
                           }
                         ],
          'description' => 'The following works:
    <at name="cn" rdn="true">
      <expression>slipupi.upi</expression>
    </at>

However, the following, equivalent config, doesn't:
    <at name="cn" rdn="true">
      <expression>return slipupi.upi;</expression>
    </at>

I'll attach more details.

',
          'affectsVersions' => [
                               {
                                 'releaseDate' => '2005-12-05 00:00:00.0',
                                 'sequence' => '8',
                                 'name' => 'Penrose-0.9.8',
                                 'released' => 'true',
                                 'id' => '10034',
                                 'archived' => 'false'
                               }
                             ],
          'created' => '2005-12-14 23:24:01.0',
          'environment' => 'linux, penrose 0.9.8, oracle',
          'resolution' => '1',
          'type' => '1'
        };


=========================================================

Comment 1 Chandrasekar Kannan 2008-12-27 08:00:44 UTC
Marking bug as MODIFIED as it was already resolved in Jira - PENROSE-129


Note You need to log in before you can comment on or make changes to this bug.