tpalfy commented on a change in pull request #5145:
URL: https://github.com/apache/nifi/pull/5145#discussion_r680916610



##########
File path: 
nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jaxb/JAXBSerializer.java
##########
@@ -73,8 +79,12 @@ public void serialize(final int dataModelVersion, final T t, 
final OutputStream
         try {
             final Marshaller marshaller = jaxbContext.createMarshaller();
             marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-            marshaller.marshal(t, out);
-        } catch (JAXBException e) {
+
+            String className = clazz.getSimpleName();
+            String tagName = Character.toLowerCase(className.charAt(0)) + 
className.substring(1);
+
+            marshaller.marshal(new JAXBElement<>(new QName(tagName), clazz, 
t), out);

Review comment:
       I'd rather not pull a direct reference to `VersionedProcessGroup` into 
this class.
   Not a fan of reflection either - I'd stay strongly typed if I can help.
   
   I have a third option: try to marshal the old way, if that doesn't work, 
fall back to the new way.




-- 
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]


Reply via email to