Detailed information about defect clone:

26-C1.H0.M0.L0_T_S_01.war

 

Nickname of the defect

teacher-empty-table-all-the-time

Brief desctiption

The table Taught Subjects in My Subjects is always empty.

How to activate the defect

 

Visibility of the defect

Expected Actual

Parts

StudentService TeacherService DateUtility GradeDAO UserDAO
BaseStudentService E01TeacherService BaseDateUtility GradeTypeDaoCriteria UserDaoCriteria

URL to the defect source code

https://gitlab.kiv.zcu.cz/herout/TbUIS-UIS/blob/master/src/main/java/cz/zcu/kiv/matyasj/dp/service/users/error/E01TeacherService.java

Source code with the injected defect

/** * DELIBERATE ERROR * * This method returns always null instead of list of all Subject of specific teacher. * * @param teacher Teacher domain object. * @return List of subjects */ @Override @ErrorMethod(errorMessage = "This method returns always null instead of list of all Subject of specific teacher.") public List<Subject> getTaughtSubjectsList(Teacher teacher) { log.error(propertyLoader.getProperty("log.E01TeacherService.getTaughtSubjectsList")); return null; }

URL to the correct source code

https://gitlab.kiv.zcu.cz/herout/TbUIS-UIS/blob/master/src/main/java/cz/zcu/kiv/matyasj/dp/service/users/correct/BaseTeacherService.java

Correct source code

/** * This method returns list of all Subject of specific teacher. * This teacher teaches subjects in list. * * @param teacher Teacher domain object. * @return List of subjects */ @Override public List<Subject> getTaughtSubjectsList(Teacher teacher) { if (teacher == null) { log.error("Getting list of taught subjects failed."); return null; } log.info("Getting list of taught subjects for teacher with id " + teacher.getId() + "."); Teacher tmpTeacher = (Teacher) userDao.findOne(teacher.getId()); return sortListOfSubjects(tmpTeacher.getListOfTaughtSubjects()); }

Logged information up to failure

2019-10-12 15:41:01.809 -- INFO LogHelper:31 - HHH000204: Processing PersistenceUnitInfo [name: cz.zcu.kiv.matyasj.dp] 2019-10-12 15:41:02.043 -- INFO Version:46 - HHH000412: Hibernate Core {5.4.1.Final} 2019-10-12 15:41:02.465 -- INFO Version:49 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2019-10-12 15:41:02.949 -- INFO C3P0ConnectionProvider:116 - HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/uis-web-db 2019-10-12 15:41:02.949 -- INFO C3P0ConnectionProvider:117 - HHH10001001: Connection properties: {password=****, useUnicode=true, handling_mode=DELAYED_ACQUISITION_AND_HOLD, characterEncoding=UTF-8, user=uis-web} 2019-10-12 15:41:02.949 -- INFO C3P0ConnectionProvider:120 - HHH10001003: Autocommit mode: false 2019-10-12 15:41:03.184 -- INFO C3P0ConnectionProvider:200 - HHH10001007: JDBC isolation level: <unknown> 2019-10-12 15:41:03.621 -- INFO Dialect:158 - HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect 2019-10-12 15:41:05.480 -- INFO access:47 - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@12d644a6] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. 2019-10-12 15:41:08.058 -- INFO access:47 - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@2d22d4b9] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. 2019-10-12 15:41:19.530 -- INFO JtaPlatformInitiator:52 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2019-10-12 15:41:19.764 -- INFO SecurityConfig:75 - SECURITY JDBC authentication process is running 2019-10-12 15:41:22.061 -- INFO SecurityConfig:93 - Authorization configuration process is running 2019-10-12 15:41:22.375 -- INFO BaseInitializer:97 - Initializing ... 2019-10-12 15:41:29.485 -- INFO BaseInitializer:463 - Initialized! 2019-10-12 15:41:29.610 -- INFO BaseInitializer:97 - Initializing ... 2019-10-12 15:42:41.679 -- INFO LoginController:30 - Request for login view 2019-10-12 15:42:50.248 -- INFO UserDaoCriteria:74 - User with username strict found. 2019-10-12 15:42:50.295 -- INFO SecurityConfig:121 - Success login - strict 2019-10-12 15:42:50.295 -- INFO SecurityConfig:125 - User login role: ROLE_TEACHER 2019-10-12 15:42:50.310 -- INFO UserDaoCriteria:74 - User with username strict found. 2019-10-12 15:42:50.326 -- INFO OverviewController:53 - Request for overview of teacher with id 32 for view. 2019-10-12 15:42:52.827 -- INFO ListOfTaughtSubjectController:45 - Request for retrieving list of taught subjects for view. 2019-10-12 15:42:52.827 -- INFO UserDaoCriteria:74 - User with username strict found. 2019-10-12 15:42:52.874 -- ERROR E01TeacherService:54 - INJECTED_ERROR: E01TeacherService_getTaughtSubjectsList_returns_always_null_instead_of_list_of_all_Subject_of_specific_teacher

Overview of functional tests full log

Overview of acceptance tests full report