rmannibucau opened a new issue, #9037:
URL: https://github.com/apache/hop/issues/9037
### Summary
When a pipeline saved by an older Hop (<= 2.x) contains a Calculator
transform whose `calculation` entries do **not** write `value_length` /
`value_precision`, restoring the pipeline yields `valueLength = 0` /
`valuePrecision = 0` instead of the legacy `-1` sentinel. This is a regression
introduced by **PR #795** (HOP-2849), which replaced the hand-written XML
loader of `CalculatorMetaFunction` with `@HopMetadataProperty`-based automatic
(de)serialization.
### Root cause
Prior to PR #795, `CalculatorMetaFunction(Node)` read the tags with a `-1`
default:
```java
valueLength = Const.toInt(XmlHandler.getTagValue(calcnode,
"value_length"), -1);
valuePrecision = Const.toInt(XmlHandler.getTagValue(calcnode,
"value_precision"), -1);
```
PR #795 dropped that loader and switched to annotation-driven
deserialization. The fields were declared as plain `int` (`private int
valueLength;` / `private int valuePrecision;`), which deserialize to Java's
default `0` when the tag is absent — the `-1` sentinel ("unspecified
length/precision") was never carried over.
### Impact
- `CalculatorMeta.getValueMeta()` calls `v.setLength(fn.getValueLength())` /
`v.setPrecision(...)`; a `0` forces an explicit length=0 instead of keeping the
type's default (behaviour differs from `-1`).
- `CalculatorDialog` treats `-1` as "blank" (`Const.toInt(item.getText(7),
-1)`, and only shows a length when `>= 0`), so a restored function now displays
`0` in the Length/Precision columns and re-persists `0`.
### Proposed fix
Initialize the two fields to `-1`:
```java
private int valueLength = -1;
private int valuePrecision = -1;
```
(Initialization at the field site covers both the empty constructor and the
automatic deserialization path.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]