Project: bamboo
Issue BAM-6957: Job/Chain Name duplication throws exception
My Project Name: AAAA My Chain Name: AAAA In one instance I tried to update an existing job to have the name AAAA. I got a validation error. I should theoretically be able to name my plan like this shouldn't I? During an attempt to reproduce the above behaviour, I tried to create a _new_ Job with the name AAAA. This submitted successfully. However now I get a whole bunch of other exceptions: {code} 2010-09-30 10:17:41,755 ERROR [1638360365@qtp-1196121930-6] [FiveOhOh] 500 Exception was thrown. org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2 org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:590) org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353) org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375) org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337) com.atlassian.bamboo.plan.PlanHibernateDao.getPlanByName(PlanHibernateDao.java:83) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) {code} The getPlanByName method only looks at the project name and plan name in the build table. And hence will return both the chain and the job. So we need to either a) prevent people from creating jobs with the same name as a plan (though this behaves the opposite to how we handle the keys) b) fix the getPlanByName method, and any other use cases which die because of the duplication.
Story points: 2