Detailed information about defect clone:

25-C1.H0.M0.L0_S_S_01.war

 

Nickname of the defect

student-empty-table-all-the-time

Brief desctiption

The table Enrolled Subjects in My Subjects is always empty.

How to activate the defect

 

Visibility of the defect

Expected Actual

Parts

StudentService TeacherService DateUtility GradeDAO UserDAO
E01StudentService BaseTeacherService 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/E01StudentService.java

Source code with the injected defect

/** * DELIBERATE ERROR * * This method returns null instead of list of subjects that one particular * student studies. * * @param studentId database student id * @return List of studied subjects */ @Override @ErrorMethod(errorMessage = "This method returns always null instead of list of subjects.") public List<Subject> getStudiedSubjectsList(Long studentId) { log.error(propertyLoader.getProperty("log.E01StudentService.getStudiedSubjectsList")); 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/BaseStudentService.javaa

Correct source code

/** * This method returns list of subjects that one particular * student studies. * * @param studentId database student id * @return List of studied subjects */ @Override public List<Subject> getStudiedSubjectsList(Long studentId) { User student = userDao.findOne(studentId); if (student instanceof Student) { log.info("Getting list of studied subjects for student with id " + studentId + "."); return sortListOfSubjects(((Student) student).getListOfLearnedSubjects()); } log.error("Getting list of studied subjects failed."); return null; }

Logged information up to failure

2019-10-15 18:16:24.639 -- INFO LogHelper:31 - HHH000204: Processing PersistenceUnitInfo [name: cz.zcu.kiv.matyasj.dp] 2019-10-15 18:16:24.857 -- INFO Version:46 - HHH000412: Hibernate Core {5.4.1.Final} 2019-10-15 18:16:25.279 -- INFO Version:49 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2019-10-15 18:16:25.685 -- INFO C3P0ConnectionProvider:116 - HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/uis-web-db 2019-10-15 18:16:25.685 -- INFO C3P0ConnectionProvider:117 - HHH10001001: Connection properties: {password=****, useUnicode=true, handling_mode=DELAYED_ACQUISITION_AND_HOLD, characterEncoding=UTF-8, user=uis-web} 2019-10-15 18:16:25.685 -- INFO C3P0ConnectionProvider:120 - HHH10001003: Autocommit mode: false 2019-10-15 18:16:25.873 -- INFO C3P0ConnectionProvider:200 - HHH10001007: JDBC isolation level: <unknown> 2019-10-15 18:16:26.248 -- INFO Dialect:158 - HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect 2019-10-15 18:16:27.998 -- INFO access:47 - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@1bd5577e] 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-15 18:16:30.881 -- INFO access:47 - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@2d45db20] 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-15 18:16:44.861 -- INFO JtaPlatformInitiator:52 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2019-10-15 18:16:45.080 -- INFO SecurityConfig:75 - SECURITY JDBC authentication process is running 2019-10-15 18:16:47.267 -- INFO SecurityConfig:93 - Authorization configuration process is running 2019-10-15 18:16:47.611 -- INFO BaseInitializer:97 - Initializing ... 2019-10-15 18:16:55.048 -- INFO BaseInitializer:463 - Initialized! 2019-10-15 18:16:55.196 -- INFO BaseInitializer:97 - Initializing ... 2019-10-15 18:18:34.321 -- INFO LoginController:30 - Request for login view 2019-10-15 18:18:41.209 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:41.241 -- INFO SecurityConfig:121 - Success login - maroon 2019-10-15 18:18:41.241 -- INFO SecurityConfig:125 - User login role: ROLE_STUDENT 2019-10-15 18:18:41.272 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:41.287 -- INFO OverviewController:49 - Request for overview of student with id 16 for view. 2019-10-15 18:18:43.412 -- INFO RegisterSubjectListController:48 - Request for retrieving studied subjects view. 2019-10-15 18:18:43.412 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:43.428 -- ERROR E01StudentService:58 - INJECTED_ERROR: E01StudentService_getStudiedSubjectsList_returns_always_null_instead_of_list_of_subjects 2019-10-15 18:18:43.428 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:43.459 -- INFO BaseStudentService:101 - Getting list of absolved subjects for student with id 16. 2019-10-15 18:18:43.459 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:43.475 -- INFO BaseStudentService:222 - Getting list of grades for student with id 16. 2019-10-15 18:18:43.490 -- INFO GradeDaoCriteria:102 - Returning list of 0 for student with id 16 2019-10-15 18:18:43.506 -- INFO UserDaoCriteria:74 - User with username maroon found. 2019-10-15 18:18:43.537 -- INFO BaseStudentService:426 - Getting total number of credits for student with id 16.

Overview of functional tests full log

Overview of acceptance tests full report