Project

General

Profile

Actions

bug #5211

open

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

Added by Cherian Mathew over 7 years ago. Updated almost 2 years ago.

Status:
In Progress
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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 ProgressAndreas Müller

Actions
Related to EDIT - bug #10101: Correct mapping and handling of sorted tree structuresIn ProgressAndreas Müller

Actions
Actions #1

Updated by Cherian Mathew over 7 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.

Actions #2

Updated by Cherian Mathew over 7 years ago

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

Updated by Andreas Müller over 7 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"?

Actions #4

Updated by Cherian Mathew about 7 years ago

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

Updated by Andreas Müller about 7 years ago

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

Updated by Andreas Müller about 7 years ago

  • Status changed from In Progress to New
Actions #7

Updated by Andreas Müller over 6 years ago

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

Probably fixed with better handling for null values in merge.

Actions #8

Updated by Andreas Müller over 6 years ago

  • Target version deleted (Unassigned CDM tickets)
Actions #9

Updated by Katja Luther almost 6 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)



Actions #10

Updated by Andreas Müller almost 6 years ago

  • Target version set to Release 4.7
Actions #11

Updated by Andreas Müller almost 6 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.

Actions #12

Updated by Andreas Müller almost 6 years ago

  • Description updated (diff)
Actions #13

Updated by Andreas Müller almost 6 years ago

  • Description updated (diff)
Actions #14

Updated by Andreas Müller almost 6 years ago

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

Updated by Andreas Müller almost 6 years ago

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

Updated by Andreas Müller almost 6 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.

Actions #17

Updated by Andreas Müller over 5 years ago

  • Target version changed from Release 4.7 to Release 4.8
Actions #18

Updated by Andreas Müller over 5 years ago

  • Target version changed from Release 4.8 to Release 4.9
Actions #19

Updated by Andreas Müller over 5 years ago

  • Target version changed from Release 4.9 to Release 4.10
Actions #20

Updated by Andreas Müller over 5 years ago

  • Target version changed from Release 4.10 to Release 4.11
Actions #21

Updated by Andreas Müller over 5 years ago

  • Target version changed from Release 4.11 to Release 4.12
Actions #22

Updated by Andreas Müller about 5 years ago

  • Target version changed from Release 4.12 to Release 4.13
Actions #23

Updated by Andreas Müller about 5 years ago

  • Target version changed from Release 4.13 to Release 4.14
Actions #24

Updated by Andreas Müller almost 5 years ago

  • Target version changed from Release 4.14 to Release 5.0
Actions #25

Updated by Andreas Müller over 4 years ago

  • Target version changed from Release 5.0 to Release 5.1
Actions #26

Updated by Andreas Müller over 4 years ago

  • Target version changed from Release 5.1 to Release 5.2
Actions #27

Updated by Andreas Müller over 4 years ago

  • Target version changed from Release 5.2 to Release 5.3
Actions #28

Updated by Andreas Müller over 4 years ago

  • Target version changed from Release 5.3 to Release 5.4
Actions #29

Updated by Andreas Müller over 4 years ago

  • Target version changed from Release 5.4 to Release 5.5
Actions #30

Updated by Andreas Müller almost 4 years ago

  • Target version changed from Release 5.5 to Release 5.6
Actions #31

Updated by Andreas Müller almost 4 years ago

  • Target version changed from Release 5.6 to Release 5.7
Actions #32

Updated by Andreas Müller almost 4 years ago

  • Target version changed from Release 5.7 to Release 5.8
Actions #33

Updated by Andreas Müller over 3 years ago

  • Target version changed from Release 5.8 to Release 5.10
Actions #34

Updated by Andreas Müller over 3 years ago

  • Target version changed from Release 5.10 to Release 5.11
Actions #35

Updated by Andreas Müller over 3 years ago

  • Target version changed from Release 5.11 to Release 5.12
Actions #36

Updated by Andreas Müller about 3 years ago

  • Target version changed from Release 5.12 to Release 5.13
Actions #37

Updated by Andreas Müller almost 3 years ago

  • Target version changed from Release 5.13 to Release 5.14
Actions #38

Updated by Andreas Müller almost 3 years ago

  • Target version changed from Release 5.14 to Release 5.15
Actions #39

Updated by Andreas Müller over 2 years ago

  • Target version changed from Release 5.15 to Release 5.18
Actions #40

Updated by Andreas Müller about 2 years ago

  • Target version changed from Release 5.18 to Release 5.19
Actions #41

Updated by Andreas Müller about 2 years ago

  • Target version changed from Release 5.19 to Release 5.21
Actions #42

Updated by Andreas Müller almost 2 years ago

  • Target version changed from Release 5.21 to Release 5.22
Actions #43

Updated by Andreas Müller almost 2 years ago

  • Target version changed from Release 5.22 to Release 5.38
Actions #45

Updated by Andreas Müller 7 months ago

  • Related to bug #10101: Correct mapping and handling of sorted tree structures added
Actions

Also available in: Atom PDF