sumit3203 / ACTIVESEGMENTATION

Active Segmentation Project
https://sumit3203.github.io.
Other
6 stars 19 forks source link

UnrecognizedPropertyException #48

Closed dprodanov closed 3 years ago

dprodanov commented 4 years ago

We must implement graceful degradation in the case of "unknown" properties. I.e. future versions of the project file.

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "platformPath" (class activeSegmentation.io.ProjectInfo), not marked as ignorable (16 known properties: "projectDescription", "projectName", "groundtruth", "classes", "modifyDate", "trainingStack", "projectType", "featureList", "createdDate", "featureSelection", "pluginPath", "testingStack" [truncated]]) at [Source: C:\Users\prodanov\Documents\freya\freya\freya.json; line: 11, column: 21] (through reference chain: activeSegmentation.io.ProjectInfo["platformPath"]) at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51) at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:671) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:762) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1297) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1275) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2993) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2052) at activeSegmentation.io.ProjectManagerImp.loadProject(ProjectManagerImp.java:140) at activeSegmentation.gui.CreateProjectUI.doAction(CreateProjectUI.java:104) at activeSegmentation.gui.CreateProjectUI.access$0(CreateProjectUI.java:89) at activeSegmentation.gui.CreateProjectUI$1.actionPerformed(CreateProjectUI.java:287) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at activeSegmentation.feature.FeatureManagerNew.(FeatureManagerNew.java:112) at activeSegmentation.gui.Gui.(Gui.java:56) at activeSegmentation.gui.CreateProjectUI.doAction(CreateProjectUI.java:105) at activeSegmentation.gui.CreateProjectUI.access$0(CreateProjectUI.java:89) at activeSegmentation.gui.CreateProjectUI$1.actionPerformed(CreateProjectUI.java:287) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

Purva-Chaudhari commented 3 years ago

@dprodanov Let me know if the issue is open to work on. I would like to contribute to it!

dprodanov commented 3 years ago

@Purva-Chaudhari The issue is still open. Your contribution is welcome.

Purva-Chaudhari commented 3 years ago

@dprodanov Sure!, According to my understanding, I guess we have to include @JsonIgnore for platformPath and include a method public void platformPath(List platformPath) { this.platformPath = platformPath; } in class activeSegmentation.io.ProjectInfo

Please do correct me if wrong or else I may proceed with a pull request

dprodanov commented 3 years ago

Nope,

The correct way is to ignore unknown properties without triggering exceptions.

best regards,

Dimiter

On Tue, Mar 9, 2021 at 3:41 PM Purva-Chaudhari notifications@github.com wrote:

@dprodanov https://github.com/dprodanov Sure!, According to my understanding, I guess we have to include @JsonIgnore for platformPath and include a method public void platformPath(List platformPath) { this.platformPath = platformPath; } in class activeSegmentation.io.ProjectInfo

Please do correct me if wrong or else I may proceed with a pull request

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sumit3203/ACTIVESEGMENTATION/issues/48#issuecomment-793985923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANM2ONBKM6MCO7DHZLWKGDTCYXTDANCNFSM4K2STMRQ .

Purva-Chaudhari commented 3 years ago

Oh Yes ! sorry, We can do it using annotation com.fasterxml.jackson.annotation.JsonIgnoreProperties following public class or or using ObjectMapper configuration deserialization.

[Can we continue further discussion on PR ?

Kind regards

Nope, The correct way is to ignore unknown properties without triggering exceptions. best regards, Dimiter On Tue, Mar 9, 2021 at 3:41 PM Purva-Chaudhari @.***> wrote: @dprodanov https://github.com/dprodanov Sure!, According to my understanding, I guess we have to include @JsonIgnore for platformPath and include a method public void platformPath(List platformPath) { this.platformPath = platformPath; } in class activeSegmentation.io.ProjectInfo Please do correct me if wrong or else I may proceed with a pull request — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#48 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANM2ONBKM6MCO7DHZLWKGDTCYXTDANCNFSM4K2STMRQ .

sumit3203 commented 3 years ago

Fixed by Purva