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
0%
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:- Run a full conversion.
- Replace the code of
a.pwithMESSAGE "a.p".and run an incremental conversion. It aborts withError loading AST file/resource: ./cvt/a.p.schema. - Add a comment to
b.pand run an incremental conversion. It aborts with the same error. - Add a comment to
c.pand run an incremental conversion. It aborts with the same error, althoughc.phas no temp-table. - Run an incremental conversion without changing any file. It reports
INCREMENTAL CONVERSION: no changed files foundand succeeds, butA.javastill usestta, andB.javaandC.javamiss the comments of steps 3 and 4.
- Run a full conversion.
- Rename
a.ptoa2.pand run an incremental conversion. It aborts with aNullPointerException. - Run an incremental conversion without changing any file. It succeeds, but
A2.javais never generated. - Add a comment to
b.pand run an incremental conversion. It aborts with the sameNullPointerException.
- Run a full conversion.
- Delete
a.p, add a comment tob.p, and run an incremental conversion ofb.ponly. It aborts with the sameNullPointerException. - Run an incremental conversion without changing any file. It succeeds, but
B.javamisses the comment of step 2. - Add another comment to
b.pand run an incremental conversion. It aborts with the sameNullPointerException.
- Run a full conversion.
- Delete
a.pand run an incremental conversion. It succeeds. - Add a comment to
b.pand run an incremental conversion. It aborts with the sameNullPointerException.
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.