Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25849

Fix NPE on null dc:expired in EasyShare

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.3
    • Component/s: EasyShare

      Description

      When dc:expired is null, an NPE is raised. This is a situation that shouldn't happen, as the UI is supposed to make this field mandatory, but nevertheless it's been observed. So better make the code robust.

      Symptoms:

      {"entity-type":"exception","code":"com.sun.jersey.api.container.ContainerException",
      "status":500,
      "message":"Unable to create resource class org.nuxeo.easyshare.EasyShare"}
      

      After live debug the NPE is here in org.nuxeo.easyshare.EasyShare.checkIfShareIsValid(DocumentModel)

          if (today.after(docShare.getProperty("dc:expired").getValue(Date.class))) 
      

      Here docShare.getProperty("dc:expired") is null so provokes this NullPointerException:

      	java.util.Date.after(java.util.Date) line: 931	
      	org.nuxeo.easyshare.EasyShare.checkIfShareIsValid(org.nuxeo.ecm.core.api.DocumentModel) line: 167	
      	org.nuxeo.easyshare.EasyShare.access$000(org.nuxeo.easyshare.EasyShare, org.nuxeo.ecm.core.api.DocumentModel) line: 64	
      	org.nuxeo.easyshare.EasyShare$1.run(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.api.IdRef) line: 89	
      	org.nuxeo.easyshare.EasyShare$1(org.nuxeo.easyshare.EasyShareUnrestrictedRunner).runUnrestricted(java.lang.String) line: 56	
      	org.nuxeo.easyshare.EasyShare.getShareListing(java.lang.String, java.lang.Long) line: 198	
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h