nus-oss-test / testrepo4

TEAMMATES system is online at
http://teammatesv4.appspot.com
0 stars 0 forks source link

java.lang.AssertionError: Student should not be null at this point. #1673

Closed damithc closed 10 years ago

damithc commented 10 years ago

From dam...@gmail.com on February 12, 2014 07:41:13

Request Parameters {message::abchas already joined this course, error::true, user::abc}

Stack Trace

java.lang.AssertionError: Student should not be null at this point. at teammates.common.util.Assumption.fail(Assumption.java:56) at teammates.common.util.Assumption.assertTrue(Assumption.java:25) at teammates.common.util.Assumption.assertNotNull(Assumption.java:252) at teammates.logic.core.CoursesLogic.getCourseDetailsListForStudent(CoursesLogic.java:152) at teammates.logic.api.Logic.getCourseDetailsListForStudent(Logic.java:464) at teammates.ui.controller.StudentHomePageAction.execute(StudentHomePageAction.java:33) at teammates.ui.controller.Action.executeAndPostProcess(Action.java:125) at teammates.ui.controller.ControllerServlet.doPost(ControllerServlet.java:48) at teammates.ui.controller.ControllerServlet.doGet(ControllerServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at teammates.ui.controller.LoginFilter.doFilter(LoginFilter.java:46) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at teammates.storage.datastore.DatastoreFilter.doFilter(DatastoreFilter.java:28) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java:141) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:446) at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437) at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444) at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:188) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300) at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441) at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251) at java.lang.Thread.run(Thread.java:724)

Original issue: http://code.google.com/p/teammatespes/issues/detail?id=1606

damithc commented 10 years ago

From arnold.k...@gmail.com on February 11, 2014 18:22:26

Possible cause: Student A tried to join using Student B's link and then gets redirected to studentHomePAge. But as A failed to join he has no student attributes and trigger this error.

Expected behaviour: He should've been given the welcome stranger message.

Status: Started

damithc commented 10 years ago

From arnold.k...@gmail.com on February 11, 2014 18:38:53

Code snippet that causes the error:

143 public List getCourseDetailsListForStudent( 144 String googleId) throws EntityDoesNotExistException { 145
146 List courseList = getCoursesForStudentAccount(googleId); 147 List courseDetailsList = new ArrayList(); 148
149 for (CourseAttributes c : courseList) { 150 151 StudentAttributes s = studentsLogic.getStudentForGoogleId(c.id, googleId); 152 Assumption.assertNotNull("Student should not be null at this point.", s);

Here in line 146 the student attribute is already used to generate the list of courses. In fact courseList is generated by retireving all student attribute associated with the google id so the course can't be in the list unless the student attribute is in the list, so the student attributes really cannot be null at this point.

Google datastore transient error? Maybe retrieval can retry if failed?

damithc commented 10 years ago

From arnold.k...@gmail.com on February 11, 2014 18:40:09

The method called in 146:

public List<CourseAttributes> getCoursesForStudentAccount(String googleId) throws EntityDoesNotExistException {

    List<StudentAttributes> studentDataList = studentsLogic.getStudentsForGoogleId(googleId);

    if (studentDataList.size() == 0) {
        throw new EntityDoesNotExistException("Student with Google ID "
                + googleId + " does not exist");
    }

    ArrayList<CourseAttributes> courseList = new ArrayList<CourseAttributes>();

    for (StudentAttributes s : studentDataList) {
        CourseAttributes course = coursesDb.getCourse(s.course);
        if(course==null){
            log.warning(
                    "Course was deleted but the Student still exists :"+Const.EOL 
                    + s.toString());
        }else{
            courseList.add(course);
        }
    }
    return courseList;
}
damithc commented 10 years ago

From arnold.k...@gmail.com on February 12, 2014 18:18:25

More logging here also

damithc commented 10 years ago

From arnold.k...@gmail.com on February 12, 2014 23:01:31

https://codereview.appspot.com/63000043/

Status: ReadyForReview

damithc commented 10 years ago

From dam...@gmail.com on February 12, 2014 23:17:04

Status: ReadyToMerge

damithc commented 10 years ago

From arnold.k...@gmail.com on February 12, 2014 23:20:26

This issue was updated by revision dc935c35d7c0 .

Status: Delivered

damithc commented 10 years ago

From dam...@gmail.com on February 14, 2014 19:02:37

Status: Deployed
Labels: Milestone-V4.87

damithc commented 10 years ago

From arnold.k...@gmail.com on February 26, 2014 01:58:32

This issue was updated by revision dc935c35d7c0 .

Status: Delivered

damithc commented 10 years ago

From dam...@gmail.com on February 26, 2014 02:49:10

Status: Deployed