Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3998

ORCID - NullPointException by querying orcid web services

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Code Review Needed (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 6.3
    • Fix Version/s: None
    • Component/s: API
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      1

      Description

      I used author lookup to search for an author with given name "Thomas", in the log file I saw an NullPointException in class org.dspace.authority.orcid.Orcidv2AuthorityValue#setValues(Person). And I got nothing in the lookup list. 

      While searching at orcid.org with the same key "Thomas" I got a list of authors, some have no family name. The NullPointException looks like that caused by calling name.getFamilyName().getValue() in the setValues(Person) method. 

      I don't know why orcid.org allows "bad" data, but I think that althrough we can throw the "bad" record directly. 

      I added a try/catch in this method and let it return null by exception (see below). It works well. The author list is not empty any more.

       

      protected void setValues(Person person) {
          try {
            	 NameType name = person.getName();
              if (!StringUtils.equals(name.getPath(), authority.getOrcid_id())) {
              	authority.setOrcid_id(name.getPath());
              }
              if (!StringUtils.equals(name.getFamilyName().getValue(), authority.getLastName())) {
              	authority.setLastName(name.getFamilyName().getValue());
              }
              ...
              authority.setValue(authority.getName());
          } catch (Exception e) {
          	// throws bad record
              return null;
         }
         return authority;
      }
      

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            qzhao Qin Zhao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: