Project

General

Profile

Bug #12107

Incremental conversion fails when a temp-table is removed from a program, or a program defining one is renamed or deleted, and later runs report success with stale Java

Added by Octavian Adrian Gavril about 7 hours ago. Updated about 6 hours ago.

Status:
WIP
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

0%

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

History

#1 Updated by Octavian Adrian Gavril about 7 hours ago

Incremental conversion fails when a temp-table is removed from a program, and when a program which defines a temp-table is renamed or deleted. The error then repeats in later incremental conversions, and a rerun without any source change reports success while the Java no longer matches the 4GL code. Only ant clean.convert and a new conversion of everything repair the project.

All cases were reproduced on trunk 16826. The testcase has three programs. a.p and b.p define the same temp-table, and c.p has none.

a.p:

DEFINE TEMP-TABLE tta NO-UNDO
   FIELD f1 AS INTEGER
   FIELD f2 AS CHARACTER
   INDEX ix1 IS PRIMARY f1.

CREATE tta.
tta.f1 = 1.
FOR EACH tta:
   MESSAGE "a.p" tta.f1 tta.f2.
END.

b.p:

DEFINE TEMP-TABLE tta NO-UNDO
   FIELD f1 AS INTEGER
   FIELD f2 AS CHARACTER
   INDEX ix1 IS PRIMARY f1.

CREATE tta.
tta.f1 = 1.
FOR EACH tta:
   MESSAGE "b.p" tta.f1 tta.f2.
END.

c.p:

MESSAGE "c.p".

Each case starts from these three programs. An incremental conversion converts all programs, unless a step says otherwise.

Removing the temp-table from a program fails, and so does every later conversion:
  1. Run a full conversion.
  2. Replace the code of a.p with MESSAGE "a.p". and run an incremental conversion. It aborts with Error loading AST file/resource: ./cvt/a.p.schema.
  3. Add a comment to b.p and run an incremental conversion. It aborts with the same error.
  4. Add a comment to c.p and run an incremental conversion. It aborts with the same error, although c.p has no temp-table.
  5. Run an incremental conversion without changing any file. It reports INCREMENTAL CONVERSION: no changed files found and succeeds, but A.java still uses tta, and B.java and C.java miss the comments of steps 3 and 4.
Renaming a program which defines a temp-table fails:
  1. Run a full conversion.
  2. Rename a.p to a2.p and run an incremental conversion. It aborts with a NullPointerException.
  3. Run an incremental conversion without changing any file. It succeeds, but A2.java is never generated.
  4. Add a comment to b.p and run an incremental conversion. It aborts with the same NullPointerException.
Deleting a program which defines a temp-table fails when the next conversion names a single file:
  1. Run a full conversion.
  2. Delete a.p, add a comment to b.p, and run an incremental conversion of b.p only. It aborts with the same NullPointerException.
  3. Run an incremental conversion without changing any file. It succeeds, but B.java misses the comment of step 2.
  4. Add another comment to b.p and run an incremental conversion. It aborts with the same NullPointerException.
Deleting the program and converting all programs succeeds only for that run:
  1. Run a full conversion.
  2. Delete a.p and run an incremental conversion. It succeeds.
  3. Add a comment to b.p and run an incremental conversion. It aborts with the same NullPointerException.

All these errors are raised by the rule preTmpTabNames = createMapAstKeyToString("pre_tmpTabNames") in rules/fixups/stable_naming.xml. The error of the removal case is:

Caused by: com.goldencode.ast.AstException: Error loading AST file/resource: ./cvt/a.p.schema
    at com.goldencode.ast.XmlFilePlugin.loadTree(XmlFilePlugin.java:335)
    at com.goldencode.ast.AstManager.loadTree(AstManager.java:373)
    at com.goldencode.p2j.uast.AstKey.getAst(AstKey.java:697)
    at com.goldencode.p2j.uast.AstKey.equals(AstKey.java:240)
    at java.base/java.util.HashMap.putVal(HashMap.java:633)
    at java.base/java.util.HashMap.put(HashMap.java:610)
    at com.goldencode.p2j.convert.db.H2Map.lambda$new$0(H2Map.java:236)
    at com.goldencode.p2j.convert.db.DBHelper.executeQuery(DBHelper.java:597)
    at com.goldencode.p2j.convert.db.H2Map.<init>(H2Map.java:245)
    at com.goldencode.p2j.convert.db.ConversionData.createMap(ConversionData.java:1648)
    at com.goldencode.p2j.pattern.CommonAstSupport$Library.createMapAstKeyToString(CommonAstSupport.java:6505)
Caused by: java.lang.IllegalArgumentException: Missing/bogus input file/resource ./cvt/a.p.schema
    at com.goldencode.ast.XmlFilePlugin.loadTree(XmlFilePlugin.java:309)

The error of the rename and delete cases is:

Caused by: java.lang.NullPointerException: Cannot invoke "com.goldencode.artifacts.Artifact.getRelativePath()" because "artifact" is null
    at com.goldencode.ast.XmlFilePlugin.loadTree(XmlFilePlugin.java:286)
    at com.goldencode.ast.AstManager.loadTree(AstManager.java:373)
    at com.goldencode.p2j.uast.AstKey.getAst(AstKey.java:697)
    at com.goldencode.p2j.uast.AstKey.equals(AstKey.java:240)
    at java.base/java.util.HashMap.putVal(HashMap.java:633)
    at java.base/java.util.HashMap.put(HashMap.java:610)
    at com.goldencode.p2j.convert.db.H2Map.lambda$new$0(H2Map.java:236)
    at com.goldencode.p2j.convert.db.DBHelper.executeQuery(DBHelper.java:597)
    at com.goldencode.p2j.convert.db.H2Map.<init>(H2Map.java:245)
    at com.goldencode.p2j.convert.db.ConversionData.createMap(ConversionData.java:1648)
    at com.goldencode.p2j.pattern.CommonAstSupport$Library.createMapAstKeyToString(CommonAstSupport.java:6505)

When b.p defines a different temp-table than a.p, the rename and the single-file delete still fail, at other places of the same rule set. Removing the temp-table from a.p then succeeds, but the DMO of that temp-table stays in src/.

#2 Updated by Octavian Adrian Gavril about 6 hours ago

  • Assignee set to Octavian Adrian Gavril
  • Status changed from New to WIP

I'm looking into this one.

Also available in: Atom PDF