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



##########
File path: 
nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/serialization/jaxb/JAXBSerializer.java
##########
@@ -88,9 +98,15 @@ public T deserialize(final InputStream input) throws 
SerializationException {
         try {
             // Consume the header bytes.
             readDataModelVersion(input);
+
+            XMLStreamReader streamReader = 
XMLInputFactory.newInstance().createXMLStreamReader(input);
+
             final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-            return (T) unmarshaller.unmarshal(input);
-        } catch (JAXBException e) {
+            JAXBElement<T> jaxbElement = unmarshaller.unmarshal(streamReader, 
clazz);
+            T deserializedObject = jaxbElement.getValue();
+
+            return deserializedObject;

Review comment:
       I find it tremendously useful - especially during debug - to have a 
single variable as a return value instead of an expression.




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