Project

General

Profile

bug #5211

Error when creating new taxon /problem with sortindex in taxon tree

Added by Cherian Mathew about 4 years ago. Updated about 1 month ago.

Status:
In Progress
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
09/08/2015
Due date:
% Done:

0%

Severity:
normal
Found in Version:

Description

Following error occurs sometimes when creating a taxon.

java.lang.Exception: login : admin
editor version : 3.8.0.qualifier
server : test.e-taxonomy.eu / edit-test
schema version : 3.6.0.0.201527040000
os : Linux 3.13.0-62-generic amd64
java : 1.7.0_60
eu.etaxonomy.taxeditor.remoting.CdmEagerLoadingException: java.lang.ArrayIndexOutOfBoundsException: -1
    at org.hibernate.collection.internal.AbstractPersistentCollection.remoteInitialize(AbstractPersistentCollection.java:1334)
    at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:603)
    at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:143)
    at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:160)
    at org.hibernate.collection.internal.PersistentList.size(PersistentList.java:114)
    at eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.test(TaxonNodePropertyTester.java:32)
    at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
    at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
    at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
    at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
    at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
    at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
    at org.eclipse.ui.internal.navigator.NavigatorPlugin$Evaluator.run(NavigatorPlugin.java:245)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.navigator.CustomAndExpression.evaluate(CustomAndExpression.java:71)
    at org.eclipse.ui.internal.navigator.NavigatorPlugin$Evaluator.run(NavigatorPlugin.java:245)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.navigator.NavigatorPlugin.safeEvaluate(NavigatorPlugin.java:260)
    at org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor.isTriggerPoint(NavigatorContentDescriptor.java:426)
    at 
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.elementData(ArrayList.java:400)
    at java.util.ArrayList.set(ArrayList.java:428)
    at org.hibernate.collection.internal.PersistentList.readFrom(PersistentList.java:409)
    at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1312)
    at org.hibernate.loader.Loader.readCollectionElements(Loader.java:872)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:723)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:940)
    at org.hibernate.loader.Loader.doQuery(Loader.java:910)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
    at org.hibernate.loader.Loader.doList(Loader.java:2516)
    at org.hibernate.loader.Loader.doList(Loader.java:2502)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
    at org.hibernate.loader.Loader.list(Loader.java:2327)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1247)
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.bulkLoadLazies(AdvancedBeanInitializer.java:436)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeNodeNoWildcard(AdvancedBeanInitializer.java:246)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeNode(AdvancedBeanInitializer.java:120)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeNodeRecursive(AdvancedBeanInitializer.java:100)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeNodeRecursive(AdvancedBeanInitializer.java:102)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initializeAll(AdvancedBeanInitializer.java:80)
    at eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer.initialize(AdvancedBeanInitializer.java:52)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase.load(CdmEntityDaoBase.java:519)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmGenericDaoImpl.initializeCollection(CdmGenericDaoImpl.java:744)
    at eu.etaxonomy.cdm.api.service.CommonServiceImpl.initializeCollection(CommonServiceImpl.java:322)
    at sun.reflect.GeneratedMethodAccessor1840.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at com.sun.proxy.$Proxy5599.initializeCollection(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor1840.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)...

Related issues

Related to Edit - bug #6546: Adding identifier does not always work In Progress 03/30/2017

History

#1 Updated by Cherian Mathew about 4 years ago

The actual reason for this error is that one of the taxon nodes to be loaded in the navigator has sortIndex -1.

Not really sure why this happens but correcting the sortIndex in the db fixes the problem.

#2 Updated by Cherian Mathew about 4 years ago

  • Status changed from New to Resolved
  • Assignee changed from c.mathew - to Andreas Müller

#3 Updated by Andreas Müller about 4 years ago

  • Assignee changed from Andreas Müller to c.mathew -

Should we just close this ticket and wait if the sortindex issue comes up again. I currently can't reproduce.

Or should we try to create a handler for this exception to give better feedback to the user such as "Please ask your database administrator to fix this"?

#4 Updated by Cherian Mathew almost 4 years ago

  • Assignee changed from c.mathew - to Andreas Müller

#5 Updated by Andreas Müller almost 4 years ago

  • Status changed from Resolved to In Progress
  • Target version changed from Remoting 5.0 to Unassigned CDM tickets

#6 Updated by Andreas Müller almost 4 years ago

  • Status changed from In Progress to New

#7 Updated by Andreas Müller about 3 years ago

  • Description updated (diff)
  • Status changed from New to Worksforme

Probably fixed with better handling for null values in merge.

#8 Updated by Andreas Müller about 3 years ago

  • Target version deleted (Unassigned CDM tickets)

#9 Updated by Katja Luther over 2 years ago

  • Status changed from Worksforme to New
  • Assignee changed from Andreas Müller to Katja Luther

we have to reopen this ticket.
Henning created a new taxon, which had the sortindex -1.

Hallo, beim Überarbeiten des ungespreicherten Taxoneintrags: „Surirella chasei“ passiert,

VG
Henning

login : henning
editor version : 4.6.0
server : 160.45.63.173 (edit-prod) / phycobank
schema version : 4.1.0.0.201607300000
os : Windows 7 6.1 x86
java : 1.8.0_121
java.lang.ArrayIndexOutOfBoundsException: -1
                at java.util.ArrayList.elementData(ArrayList.java:418)
                at java.util.ArrayList.set(ArrayList.java:446)
                at org.hibernate.collection.internal.PersistentList.readFrom(PersistentList.java:390)
                at org.hibernate.loader.plan.exec.process.internal.CollectionReferenceInitializerImpl.finishUpRow(CollectionReferenceInitializerImpl.java:77)
                at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:121)
                at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:112)
                at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:122)
                at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)
                at org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize(AbstractLoadPlanBasedCollectionInitializer.java:88)
                at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:682)
                at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:75)
                at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1991)
                at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:550)
                at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection
                at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:546)
                at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:133)
                at org.hibernate.collection.internal.AbstractPersistentCollection$1.doWork(AbstractPersistentCollection.java:162)
                at org.hibernate.collection.internal.AbstractPersistentCollection$1.doWork(AbstractPersistentCollection.java:147)
                at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:248)
                at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:146)
                at org.hibernate.collection.internal.PersistentList.size(PersistentList.java:114)
                at eu.etaxonomy.cdm.model.taxon.TaxonNode.hasChildNodes(TaxonNode.java:950)
                at eu.etaxonomy.cdm.model.taxon.TaxonNode.updateSortIndex(TaxonNode.java:762)
                at eu.etaxonomy.cdm.model.taxon.TaxonNode.removeNullValueFromChildren(TaxonNode.java:969)
                at eu.etaxonomy.cdm.persistence.hibernate.PostMergeEntityListener.removeNullFromCollections(PostMergeEntityListener.java:87)
                at eu.etaxonomy.cdm.persistence.hibernate.PostMergeEntityListener.onMerge(PostMergeEntityListener.java:64)



#10 Updated by Andreas Müller over 2 years ago

  • Target version set to Release 4.7

#11 Updated by Andreas Müller over 2 years ago

  • Subject changed from Error when creating new taxon to Error when creating new taxon /problem with sortindex in taxon tree
  • Private changed from Yes to No

The main problem here is that the hibernate implementation of List (PersistentList) has a strange behavior in the size() method when an object is added. Size() does not change its value though a new abject is added. Instead only an ADD object is remembered in the list. As we use size for computing the sortindex this leads to problems and incorrect sortindexes.

#12 Updated by Andreas Müller over 2 years ago

  • Description updated (diff)

#13 Updated by Andreas Müller over 2 years ago

  • Description updated (diff)

#14 Updated by Andreas Müller over 2 years ago

  • Category changed from taxeditor to cdmlib
  • Status changed from New to In Progress
  • Assignee changed from Katja Luther to Andreas Müller

#15 Updated by Andreas Müller over 2 years ago

  • Related to bug #6546: Adding identifier does not always work added

#16 Updated by Andreas Müller over 2 years ago

I tried to move the sortIndex updater to hibernate saveOrUpdate listener in hope that the list is update at that point but it isn't.

#17 Updated by Andreas Müller over 2 years ago

  • Target version changed from Release 4.7 to Release 4.8

#18 Updated by Andreas Müller over 2 years ago

  • Target version changed from Release 4.8 to Release 4.9

#19 Updated by Andreas Müller about 2 years ago

  • Target version changed from Release 4.9 to Release 4.10

#20 Updated by Andreas Müller about 2 years ago

  • Target version changed from Release 4.10 to Release 4.11

#21 Updated by Andreas Müller almost 2 years ago

  • Target version changed from Release 4.11 to Release 4.12

#22 Updated by Andreas Müller almost 2 years ago

  • Target version changed from Release 4.12 to Release 4.13

#23 Updated by Andreas Müller over 1 year ago

  • Target version changed from Release 4.13 to Release 4.14

#24 Updated by Andreas Müller over 1 year ago

  • Target version changed from Release 4.14 to Release 5.0

#25 Updated by Andreas Müller over 1 year ago

  • Target version changed from Release 5.0 to Release 5.1

#26 Updated by Andreas Müller over 1 year ago

  • Target version changed from Release 5.1 to Release 5.2

#27 Updated by Andreas Müller about 1 year ago

  • Target version changed from Release 5.2 to Release 5.3

#28 Updated by Andreas Müller about 1 year ago

  • Target version changed from Release 5.3 to Release 5.4

#29 Updated by Andreas Müller 12 months ago

  • Target version changed from Release 5.4 to Release 5.5

#30 Updated by Andreas Müller 8 months ago

  • Target version changed from Release 5.5 to Release 5.6

#31 Updated by Andreas Müller 8 months ago

  • Target version changed from Release 5.6 to Release 5.7

#32 Updated by Andreas Müller 6 months ago

  • Target version changed from Release 5.7 to Release 5.8

#33 Updated by Andreas Müller 3 months ago

  • Target version changed from Release 5.8 to Release 5.10

#34 Updated by Andreas Müller about 1 month ago

  • Target version changed from Release 5.10 to Release 5.11

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)