Uploaded image for project: 'LAMS Development'
  1. LAMS Development
  2. LDEV-2473

Non-integer character in answer for checkbox type daco stops everyone from viewing daco

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.4, 2.3.4
    • Component/s: Tool Data Collection
    • Labels:
      None

      Description

      Found a value of '2&' in the answer column of a question of type checkbox. Results in number format exception:

      java.lang.NumberFormatException: For input string: "2&"
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
              at java.lang.Integer.parseInt(Integer.java:456)
              at java.lang.Integer.parseInt(Integer.java:497)
              at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.addAnswerEnumerationSummary(DacoAnswerDAOHibernate.java:119)
              at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.getQuestionSummaries(DacoAnswerDAOHibernate.java:85)
              at org.lamsfoundation.lams.tool.daco.service.DacoServiceImpl.getQuestionSummaries(DacoServiceImpl.java:489)

      Once this value is saved, no one can open the daco without getting the exception.

        Activity

        jundirl Jun-Dir Liew created issue -
        Hide
        jundirl Jun-Dir Liew added a comment -
        Found this exception when corrupt value first saved:

        java.lang.IndexOutOfBoundsException: Index: 29, Size: 29
                at java.util.LinkedList.entry(LinkedList.java:368)
                at java.util.LinkedList.get(LinkedList.java:313)
                at org.lamsfoundation.lams.tool.daco.web.action.LearningAction.saveOrUpdateRecord(LearningAction.java:357)
                at org.lamsfoundation.lams.tool.daco.web.action.LearningAction.execute(LearningAction.java:109)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
        Show
        jundirl Jun-Dir Liew added a comment - Found this exception when corrupt value first saved: java.lang.IndexOutOfBoundsException: Index: 29, Size: 29         at java.util.LinkedList.entry(LinkedList.java:368)         at java.util.LinkedList.get(LinkedList.java:313)         at org.lamsfoundation.lams.tool.daco.web.action.LearningAction.saveOrUpdateRecord(LearningAction.java:357)         at org.lamsfoundation.lams.tool.daco.web.action.LearningAction.execute(LearningAction.java:109)         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
        Hide
        jundirl Jun-Dir Liew added a comment -
        Found same IndexOutOfBoundsException in another daco tool, but this time the checkbox type question had a value of 'No' in it. Looks like ansers were shifted down by one somehow.
        Show
        jundirl Jun-Dir Liew added a comment - Found same IndexOutOfBoundsException in another daco tool, but this time the checkbox type question had a value of 'No' in it. Looks like ansers were shifted down by one somehow.
        jundirl Jun-Dir Liew made changes -
        Field Original Value New Value
        Description Found a value of '2&' in the answer column of a question of type checkbox. Results in number format exception:

        java.lang.NumberFormatException: For input string: "2&"
                at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
                at java.lang.Integer.parseInt(Integer.java:456)
                at java.lang.Integer.parseInt(Integer.java:497)
                at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.addAnswerEnumerationSummary(DacoAnswerDAOHibernate.java:119)
                at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.getQuestionSummaries(DacoAnswerDAOHibernate.java:85)
                at org.lamsfoundation.lams.tool.daco.service.DacoServiceImpl.getQuestionSummaries(DacoServiceImpl.java:489)

        Once this value is saved, no one can open the daco without getting the exception.

        Could be a specific browser that somehow entered the ampersand in the checkbox value. One solutino is to regexp-replace the non-numerals from a known-integer value.
        Found a value of '2&' in the answer column of a question of type checkbox. Results in number format exception:

        java.lang.NumberFormatException: For input string: "2&"
                at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
                at java.lang.Integer.parseInt(Integer.java:456)
                at java.lang.Integer.parseInt(Integer.java:497)
                at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.addAnswerEnumerationSummary(DacoAnswerDAOHibernate.java:119)
                at org.lamsfoundation.lams.tool.daco.dao.hibernate.DacoAnswerDAOHibernate.getQuestionSummaries(DacoAnswerDAOHibernate.java:85)
                at org.lamsfoundation.lams.tool.daco.service.DacoServiceImpl.getQuestionSummaries(DacoServiceImpl.java:489)

        Once this value is saved, no one can open the daco without getting the exception.
        Hide
        jundirl Jun-Dir Liew added a comment -
        Can't seem to reproduce this effect, although it has something to do with removing and saving records involving checkboxes. At the least, I've made it so that people can still access the daco (as learners, monitors) without getting an exception.
        Show
        jundirl Jun-Dir Liew added a comment - Can't seem to reproduce this effect, although it has something to do with removing and saving records involving checkboxes. At the least, I've made it so that people can still access the daco (as learners, monitors) without getting an exception.
        jundirl Jun-Dir Liew made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        ernieg Ernie Ghiglione added a comment -
        Tested and closed!
        Show
        ernieg Ernie Ghiglione added a comment - Tested and closed!
        ernieg Ernie Ghiglione made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            ernieg Ernie Ghiglione
            Reporter:
            jundirl Jun-Dir Liew
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development