Project

General

Profile

Bug #4156

Conversion failed with "Cannot find buffer ..."

Added by Vladimir Tsichevski almost 7 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/29/2019
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Vladimir Tsichevski almost 7 years ago

The problem

Conversion of this code fragment failed on the 'cb' stage:

DEFINE PARAMETER BUFFER bookbuffer FOR book.
FIND bookbuffer WHERE book-id = 1.

Environment

bzr revno
11326

How to reproduce

  • go to testcases, for example:
pushd ~/testcases/uast
  • make a symbolic link to the directory with a build p2j project under test:
ln -s <p2j-branch-to-test> p2j
  • create a file named 4156.p with the following contents:
DEFINE PARAMETER BUFFER bookbuffer FOR book.
FIND bookbuffer WHERE book-id = 1.

here Book is the name of a table in the p2j_test database.

  • edit the file-cvt-list.txt, put the 4156.p into it;
  • run:
P2J_HOME=p2j ant convert-all jar -D4gl.file.list=file-cvt-list.txt

You should see these warning and error messages in the program output:

     ...
     [java] ------------------------------------------------------------------------------
     [java] Code Conversion Annotations
     [java] ------------------------------------------------------------------------------
     [java]
     [java] Optional rule set [customer_specific_annotations_prep] not found.
     [java] 4156.p
     [java] Elapsed job time:  00:00:00.885
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] throwException(sprintf(spec, bufname, reftype), this)
     [java] ^  { Cannot find buffer named p2j_test.book_p2j_test.book for ref type 21! [FIELD_INT id <12884901916> 2:23] }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR! Active Rule:
     [java] -----------------------
     [java]       RULE REPORT
     [java] -----------------------
     [java] Rule Type :   WALK
     [java] Source AST:  [ book-id ] BLOCK/STATEMENT/KW_FIND/RECORD_PHRASE/KW_WHERE/EXPRESSION/EQUALS/FIELD_INT/ @2:23 {12884901916}
     [java] Copy AST  :  [ book-id ] BLOCK/STATEMENT/KW_FIND/RECORD_PHRASE/KW_WHERE/EXPRESSION/EQUALS/FIELD_INT/ @2:23 {12884901916}
     [java] Condition :  throwException(sprintf(spec, bufname, reftype), this)
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java]
     [java]
     [java]
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:540)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:562)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:874)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:983)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1 [FIELD_INT id=12884901916]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 4 more
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:484)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:497)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.RuleContainer.apply(RuleContainer.java:585)
     [java]     at com.goldencode.p2j.pattern.RuleSet.apply(RuleSet.java:98)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:262)
     [java]     ... 9 more
     [java] Caused by: com.goldencode.p2j.pattern.CommonAstSupport$UserGeneratedException: Cannot find buffer named p2j_test.book_p2j_test.book for ref type 21! [FIELD_INT id <12884901916> 2:23]
     [java]     at com.goldencode.p2j.pattern.CommonAstSupport$Library.throwException(CommonAstSupport.java:2683)
     [java]     at com.goldencode.expr.CE6707.execute(Unknown Source)
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:391)
     [java]     ... 25 more

Also available in: Atom PDF