hansva opened a new issue, #9505:
URL: https://github.com/apache/hop/issues/9505
### Apache Hop version?
2.20.0
### Java version?
21
### Operating system
Other
### What happened?
An execution information location of the type **File location**
(`local-folder`), **Neo4j** (`neo4j-location`) or **Remote**
(`remote-location`) loses its type once it has been loaded and is written out
again. The location is saved without its plugin id and can't be read back:
```
Error loading POJO field 'org.apache.hop.execution.IExecutionInfoLocation'
Cannot invoke "org.apache.hop.core.plugins.IPlugin.getMainType()" because
"plugin" is null
```
Every path that writes loaded metadata again is affected, for example a
metadata export, or the metadata JSON (`SerializableMetadataProvider`) that
remote execution and the Beam and Spark engines send along with a run. Reading
that JSON fails as a whole, so one such location makes all of the project's
metadata unreadable there.
### Cause
`IExecutionInfoLocation.ExecutionInfoLocationObjectFactory` stores a
location under `getPluginId()`. Two things leave that id empty:
- `createObject()` doesn't set the plugin id (or name) on the location it
loads.
- `FileExecutionInfoLocation`, `NeoExecutionInfoLocation` and
`RemoteExecutionInfoLocation` don't set it themselves. The caching file,
caching database, Elastic and OpenSearch locations do, which is why they work.
`DatabaseMetaObjectFactory` and `AiProviderObjectFactory` already handle
this: when the id is empty they look the plugin up in the registry by the
object's class.
### Other metadata types checked
Every plugin of every metadata property that uses an object factory was
saved through `SerializableMetadataProvider` and read back. Each was tried
three ways: as loaded from a file, as created in code, and as a `clone()` of a
loaded object. That is 290 round trips over a full set of 308 plugins.
| Property | Plugins | Loaded / cloned | Created in code |
|---|---|---|---|
| Execution information location | 7 | **3 fail** | **3 fail** |
| Execution data profile samplers | 4 | ok | 4 fail |
| Pipeline run configuration | 9 engines | ok | 7 fail |
| Workflow run configuration | 4 engines | ok | 4 fail |
| Data catalog | 1 (DataHub) | ok | 1 fails |
| Database, graph database, AI provider, data stream, variable resolver |
49, 6, 9, 3, 7 | ok | ok |
Transforms, actions, partitioners, row distributions, value types and Cypher
builder operations take their id from the plugin registry or from their own
type, so they can't lose it.
The created-in-code failures don't break anything today: every place in Hop
that creates and saves one sets the id by hand. Examples are
`ExecutionDataProfileEditor`, `DataCatalogEditor`,
`PipelineExecutionConfigurationDialog` and `ProjectsGuiPlugin`, which calls
`setEnginePluginId("Local")`. Code that forgets the id writes an object that
can't be read back.
### Proposed fix
1. **Execution information locations:** `getObjectId()` looks up a missing
plugin id in the registry by the location's class and sets it, as the database
and AI provider factories do. `createObject()` sets the plugin id and name on
the location it creates.
2. **Same fallback** in the sampler, data catalog, data stream and variable
resolver factories, so no type depends on the object setting its own id.
3. **Run configurations:** the plugin is the engine, not the configuration
class. Each engine's `createDefault…RunConfiguration()` sets its own engine
plugin id, so callers no longer have to.
4. **Saving with an empty id:** the JSON serializer refuses to write an
object with an empty id, with a message naming the object, instead of writing a
file that can't be read back.
5. **Test:** round-trip every registered plugin of every factory-backed
property through `SerializableMetadataProvider`, as loaded, as created in code
and as cloned.
### Issue Priority
Priority: 2
### Issue Component
Component: API
--
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]