LibrePlan / libreplan

LibrePlan - Open Web Planning
https://www.libreplan.dev
GNU Affero General Public License v3.0
289 stars 171 forks source link

Exception when saving a project which contains a task with a big name #1672

Closed kwoot closed 6 years ago

kwoot commented 12 years ago

(Original Bugzilla Bug ID: 1528)

Date: 2012-08-09 12:27:39 From: Jacobo Aragunde Perez \<jaragunde@igalia.com> To: Jacobo Aragunde Perez \<jaragunde@igalia.com> Version: master (1.3.x) Last updated: 2012-11-07 12:35:16


(Note: this issue was migrated automatically with bugzilla2github.py tool )

kwoot commented 6 years ago

Bugzilla Comment ID: 4269 Date: 2012-08-09 12:27:39 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

Steps to reproduce:

  1. Create or edit a project
  2. Add a task in the WBS with the name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3. Save.

Stack trace:

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:639) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.convertHibernateAccessException(AbstractSessionFactoryBean.java:303) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.translateExceptionIfPossible(AbstractSessionFactoryBean.java:282) at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:62) at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:212) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:146) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy54.findWithoutParent(Unknown Source) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand.deleteOrderElementWithoutParent(SaveCommandBuilder.java:567) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand.doTheSaving(SaveCommandBuilder.java:392) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand.access$1(SaveCommandBuilder.java:370) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand$4.execute(SaveCommandBuilder.java:295) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand$4.execute(SaveCommandBuilder.java:1) at org.libreplan.business.common.AdHocTransactionService.runOnTransaction(AdHocTransactionService.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy42.runOnTransaction(Unknown Source) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand.save(SaveCommandBuilder.java:289) at org.libreplan.web.planner.order.SaveCommandBuilder$SaveCommand.save(SaveCommandBuilder.java:273) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling$1.invoke(ConcurrentModificationHandling.java:61) at $Proxy170.save(Unknown Source) at org.libreplan.web.orders.OrderModel.save(OrderModel.java:478) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) at org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling.whenConcurrentModification(ConcurrentModificationHandling.java:100) at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy155.save(Unknown Source) at org.libreplan.web.orders.OrderCRUDController.save(OrderCRUDController.java:758) at org.libreplan.web.orders.OrderCRUDController.saveAndContinue(OrderCRUDController.java:675) at org.libreplan.web.orders.OrderCRUDController.saveAndContinue(OrderCRUDController.java:666) at org.libreplan.web.orders.OrderCRUDController$1.onEvent(OrderCRUDController.java:226) at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:192) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138) at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:517) at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:444) Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:93) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:88) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2227) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2655) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:970) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1563) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.libreplan.business.orders.daos.OrderElementDAO.findWithoutParent(OrderElementDAO.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138) ... 57 more Caused by: java.sql.BatchUpdateException: Batch entry 0 / insert org.libreplan.business.planner.entities.Task / insert into task_element (version, name, notes, start_date, start_day_duration, end_date, end_day_duration, deadline, advance_percentage, sum_of_assigned_effort, parent, base_calendar_id, id) values (0, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, NULL, 2012-03-01 +01:00:00, 0, 2012-03-01 +01:00:00, 0, NULL, 0, 0, NULL, NULL, 10304) was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2537) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1328) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2674) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247) ... 79 more

kwoot commented 6 years ago

Bugzilla Comment ID: 4270 Date: 2012-08-09 12:29:28 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

The field name is stored in DB using the type VARCHAR(255). Strings bigger than 255 will cause the exception (our example had 300 characters).

kwoot commented 6 years ago

Bugzilla Comment ID: 4273 Date: 2012-08-09 17:41:03 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

The same problem affects to field "notes" in TaskElement. In this case, the best approach would be changing the datatype to text instead of varchar, like in OrderElement.description field.

kwoot commented 6 years ago

Bugzilla Comment ID: 4274 Date: 2012-08-09 18:02:32 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

commit 89e960a4f62b4ab27aa840f1a00a77050147bdf9 Author: Jacobo Aragunde Pérez jaragunde@igalia.com Date: Thu Aug 9 19:58:30 2012 +0200

Bug #1528: Change datatype for field TaskElement.notes to TEXT, which has no lenght limit.

FEA: ItEr76S04BugFixing

commit 512b14a4803580488fdc9f7a1c90ff1264caebfd Author: Jacobo Aragunde Pérez jaragunde@igalia.com Date: Thu Aug 9 19:25:07 2012 +0200

Bug #1528: Trucate too long task names so they don't cause problems on save.

FEA: ItEr76S04BugFixing
kwoot commented 6 years ago

Bugzilla Comment ID: 4314 Date: 2012-10-11 08:32:52 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

Forgot to add this patch:

commit c064949e08a6194a754a476f6bd0a82c879ec530 Author: Jacobo Aragunde Pérez jaragunde@igalia.com Date: Tue Aug 21 10:22:21 2012 +0200

Bug #1528: Fix field TaskElement.notes in MySQL.

FEA: ItEr76S04BugFixing
kwoot commented 6 years ago

Bugzilla Comment ID: 4315 Date: 2012-10-11 10:20:39 From: Jacobo Aragunde Perez \<jaragunde@igalia.com>

I tend to think that the patch 512b14a4803580488fdc9f7a1c90ff1264caebfd is unnecessary now.

kwoot commented 6 years ago

Bugzilla Comment ID: 4353 Date: 2012-11-07 12:35:16 From: Manuel Rego Casasnovas \<rego@igalia.com>

(In reply to comment #5)

I tend to think that the patch 512b14a4803580488fdc9f7a1c90ff1264caebfd is unnecessary now.

The patch is still needed because of we don't want to allow so big task names.

And the part for the notes is already fixed. So, closing the bug.