pvillard31 opened a new pull request, #76:
URL: https://github.com/apache/nifi-api/pull/76
# Summary
NIFI-15670 - Replace List of Map with VersionedNodeState to fix JAXB
compatibility
Without the fix:
```
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running
org.apache.nifi.registry.serialization.jaxb.TestJAXBVersionedProcessGroupSerializer
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
0.083 s <<< FAILURE! -- in
org.apache.nifi.registry.serialization.jaxb.TestJAXBVersionedProcessGroupSerializer
[ERROR]
org.apache.nifi.registry.serialization.jaxb.TestJAXBVersionedProcessGroupSerializer.testSerializeDeserializeFlowSnapshot
-- Time elapsed: 0.075 s <<< ERROR!
java.lang.RuntimeException: Unable to create JAXBContext: 1 counts of
IllegalAnnotationExceptions
at
org.apache.nifi.registry.serialization.jaxb.JAXBSerializer.<init>(JAXBSerializer.java:55)
at
org.apache.nifi.registry.serialization.jaxb.JAXBVersionedProcessGroupSerializer.<init>(JAXBVersionedProcessGroupSerializer.java:27)
at
org.apache.nifi.registry.serialization.jaxb.TestJAXBVersionedProcessGroupSerializer.testSerializeDeserializeFlowSnapshot(TestJAXBVersionedProcessGroupSerializer.java:34)
Caused by:
org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
java.util.Map is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at java.util.Map
at public java.util.List
org.apache.nifi.flow.VersionedComponentState.getLocalNodeStates()
at org.apache.nifi.flow.VersionedComponentState
at public org.apache.nifi.flow.VersionedComponentState
org.apache.nifi.flow.VersionedConfigurableExtension.getComponentState()
at org.apache.nifi.flow.VersionedConfigurableExtension
at org.apache.nifi.flow.VersionedControllerService
at public java.util.Set
org.apache.nifi.flow.VersionedProcessGroup.getControllerServices()
at org.apache.nifi.flow.VersionedProcessGroup
at
org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:83)
at
org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:421)
at
org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:255)
at
org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1115)
at
org.glassfish.jaxb.runtime.v2.ContextFactory.createContext(ContextFactory.java:144)
at
org.glassfish.jaxb.runtime.v2.JAXBContextFactory.createContext(JAXBContextFactory.java:44)
at jakarta.xml.bind.ContextFinder.find(ContextFinder.java:366)
at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:605)
at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:546)
at
org.apache.nifi.registry.serialization.jaxb.JAXBSerializer.<init>(JAXBSerializer.java:53)
... 2 more
```
The NiFi Registry framework includes a `FlowContentSerializer` that supports
multiple data model versions for reading stored flow snapshots. Data model
version 1 uses a JAXB-based serializer (`JAXBVersionedProcessGroupSerializer`),
while versions 2 and 3 use Jackson. Although version 1 is a legacy format
unlikely to be encountered in practice, all serializers are eagerly
instantiated at construction time, meaning JAXB must be able to create a
context for the entire `VersionedProcessGroup` class hierarchy.
This change introduces a `VersionedNodeState` wrapper class containing
`Map<String, String>` and changes `localNodeStates` from `List<Map<String,
String>>` to `List<VersionedNodeState>`, which JAXB can handle since it is a
concrete class.
## Test plan
- [ ] `mvn clean install` on nifi-api passes
- [ ] Install the updated API locally, then run `mvn test -pl
nifi-registry/nifi-registry-core/nifi-registry-framework` on NiFi main to
confirm the 10 JAXB test failures are resolved
- [ ] `localNodeStates` is not yet used in NiFi, so there is no downstream
code to update
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue
created
### Pull Request Tracking
- [ ] Pull Request title starts with Apache NiFi Jira issue number, such as
`NIFI-00000`
- [ ] Pull Request commit message starts with Apache NiFi Jira issue number,
as such `NIFI-00000`
### Pull Request Formatting
- [ ] Pull Request based on current revision of the `main` branch
- [ ] Pull Request refers to a feature branch with one commit containing
changes
--
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]