Project

General

Profile

Actions

bug #6978

closed

NPE in DefaultReferenceCacheStrategy

Added by Andreas Kohlbecker over 4 years ago. Updated 3 months ago.

Status:
Worksforme
Priority:
New
Category:
cdmlib
Target version:
-
Start date:
09/22/2017
Due date:
% Done:

0%

Estimated time:
Severity:
normal
Found in Version:

Description

OAIPMH Service call broken by a bug in in the DefaultReferenceCacheStrategy:

http://test.e-taxonomy.eu/cdmserver/flora_cuba/reference/oai?verb=ListIdentifiers&metadataPrefix=oai_dc&set=reference

java.lang.NullPointerException
    at eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy.isNomRef(DefaultReferenceCacheStrategy.java:481)
    at eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy.getTitleCache(DefaultReferenceCacheStrategy.java:114)
    at eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy.getTitleCache(DefaultReferenceCacheStrategy.java:1)
    at eu.etaxonomy.cdm.model.common.IdentifiableEntity.generateTitle(IdentifiableEntity.java:581)
    at eu.etaxonomy.cdm.model.reference.Reference.generateTitle(Reference.java:838)
    at eu.etaxonomy.cdm.model.common.IdentifiableEntity.getTitleCache(IdentifiableEntity.java:211)
    at eu.etaxonomy.cdm.model.reference.Reference.getTitleCache(Reference.java:431)
    at eu.etaxonomy.cdm.persistence.dao.initializer.TitleAndNameCacheAutoInitializer.initialize(TitleAndNameCacheAutoInitializer.java:85)
    at eu.etaxonomy.cdm.persistence.dao.initializer.TitleAndNameCacheAutoInitializer.initialize(TitleAndNameCacheAutoInitializer.java:30)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AbstractBeanInitializer.invokePropertyAutoInitializers(AbstractBeanInitializer.java:353)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.autoinitializeBean(AdvancedBeanInitializer.java:376)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeAll(AdvancedBeanInitializer.java:70)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initialize(AdvancedBeanInitializer.java:57)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.common.VersionableDaoBase.getAuditEvents(VersionableDaoBase.java:389)
    at eu.etaxonomy.cdm.api.service.VersionableServiceBase.pageAuditEvents(VersionableServiceBase.java:67)
Actions #1

Updated by Andreas Müller over 4 years ago

  • Assignee changed from Andreas Müller to Andreas Kohlbecker

This is not necessarily a bug

    protected static boolean isNomRef(ReferenceType type){
        switch (type){
            case Article:
            case Book:
            case BookSection:

The exception happens in the second line, where the type of the reference is passed.
A reference should ALWAYS have a type therefore we do not need a null check here.

The strange thing is that there is no Reference with RefType IS NULL in cuba test DB.

BUT in the strackstrace there are lines

    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initialize(AdvancedBeanInitializer.java:57)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.common.VersionableDaoBase.getAuditEvents(VersionableDaoBase.java:389)
    at eu.etaxonomy.cdm.api.service.VersionableServiceBase.pageAuditEvents(VersionableServiceBase.java:67)

so it looks like this has to do wiht Auditing. Maybe old version of Reference are loaded. But also here only reference of REVTYPE = 2 (Deleted) exist. Ofcourse these do not have a refType as they are completely empty.

To me this looks more like a problem in the AbstractOaiPmhController. Why does it call methods to retrieve auditing data in AbstractOaiPmhController.listIdentifiers(). Or maybe it is a bit more down in the stack somewhere in the Auditing functionality.

Reassign to AK as it is maybe related to AbstractOaiPmhController.

Actions #2

Updated by Andreas Müller over 4 years ago

See similar issue #6979#note-1

Actions #3

Updated by Andreas Kohlbecker over 4 years ago

  • Tags changed from oaipmh to oaipmh, hibernate_envers
Actions #4

Updated by Andreas Müller 3 months ago

  • Status changed from New to Resolved
  • Target version changed from Unassigned CDM tickets to Release 5.28

I guess this is fixed in the meanwhile. The above link gives a result (though taking time) and the mentioned method ReferenceDefaultCacheStrategy.isNomRef() can not throw an exception anymore as it is now:

    public static boolean isNomRef(ReferenceType type){
        return type == null ? false : type.isNomRef();
    }

please verify and close as worksforme if true.

Actions #5

Updated by Andreas Kohlbecker 3 months ago

  • Status changed from Resolved to Worksforme
  • Target version deleted (Release 5.28)

yes, this is fixed, ticket can be closed

Actions

Also available in: Atom PDF