Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

In this page you can find the example usage for java.lang RuntimeException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:gov.nih.nci.caintegrator.application.download.carray23.CaArrayFileDownloader.java

/**
 * Search for samples based on name.// w w  w . jav  a  2  s .  com
 * @throws InvalidInputException 
 */
private Set<CaArrayEntityReference> searchForSamples(SearchApiUtils searchServiceHelper,
        CaArrayEntityReference experimentRef, List<String> specimenList)
        throws RemoteException, InvalidInputException {
    BiomaterialSearchCriteria criteria = new BiomaterialSearchCriteria();
    criteria.setExperiment(experimentRef);
    criteria.getTypes().add(BiomaterialType.SAMPLE);
    List<Biomaterial> samples = null;
    try {
        samples = (searchServiceHelper.biomaterialsByCriteria(criteria)).list();
    } catch (RuntimeException e) {
        reportError(e.getMessage(), e);
        e.printStackTrace();
        throw e;
    }
    Set<CaArrayEntityReference> sampleRefs = new HashSet<CaArrayEntityReference>();
    for (Biomaterial sample : samples) {
        for (String specimenName : specimenList) {
            if (sample != null && sample.getName() != null && sample.getName().contains(specimenName.trim())) {
                System.out.println(sample.getName());
                sampleRefs.add(sample.getReference());
            }
        }

    }
    return sampleRefs;
}

From source file:de.micromata.genome.tpsb.httpmockup.testbuilder.ServletContextTestBuilder.java

protected void executeServletIntern(int recCount) {
    try {/*from w w w .jav  a  2  s .c om*/
        applyCookies();
        httpResponse = new MockHttpServletResponse();
        ++reqResponseCounter;
        writeRequestToLog();
        acceptor.acceptRequest(httpRequest, httpResponse);
        storeCookies();
        writeResponseToLog();
        checkRedirect(recCount);
    } catch (RuntimeException ex) {
        ex.printStackTrace();
        throw ex;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}

From source file:org.sakaiproject.tool.assessment.ui.listener.author.StartCreateItemListener.java

public boolean startCreateItem(ItemAuthorBean itemauthorbean) {

    String nextpage = null;/*  w w w.  j  a va 2 s. c  o  m*/
    ItemBean item = new ItemBean();

    AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
    try {
        // check to see if we arrived here from question pool

        // need to set indivdiual item properties
        itemauthorbean.setCurrentItem(item);

        /*
         Use TypeFacade 's constants for item type,
          Note:   10 = import from question pool
          public static Long MULTIPLE_CHOICE = new Long(1);
          public static Long MULTIPLE_CORRECT = new Long(2); //not used
          public static Long MULTIPLE_CHOICE_SURVEY = new Long(3);
          public static Long TRUE_FALSE = new Long(4);
          public static Long ESSAY_QUESTION = new Long(5);
          public static Long FILE_UPLOAD = new Long(6);
          public static Long AUDIO_RECORDING = new Long(7);
          public static Long FILL_IN_BLANK = new Long(8);
            public static Long FILL_IN_NUMERIC = new Long(11);
          public static Long MATCHING = new Long(9);
        */

        item.setItemType(itemauthorbean.getItemType());
        itemauthorbean.setItemType("");
        itemauthorbean.setItemTypeString("");
        itemauthorbean.setAttachmentList(null);
        itemauthorbean.setResourceHash(null);

        int itype = 0; //
        log.debug("item.getItemType() = " + item.getItemType());
        if ((item.getItemType() != null) && !("".equals(item.getItemType()))) {
            log.debug("item.getItemType() integer = " + item.getItemType());
            itype = new Integer(item.getItemType()).intValue();
        } else if ("".equals(item.getItemType())) {
            log.debug("item.getItemType() , use default type 1 = " + item.getItemType());
            itype = 1; // we only appear to get here when when the mouse is clicked a lot.
        }
        log.debug("after getting item.getItemType() ");
        switch (itype) {
        case 1:
            nextpage = "multipleChoiceItem";
            break;
        case 2:
            // never really use this, put here for completeness
            nextpage = "multipleChoiceItem";
            break;
        case 12:
            nextpage = "multipleChoiceItem";
            break;
        case 3:
            nextpage = "surveyItem";
            break;
        case 4:
            nextpage = "trueFalseItem";
            break;
        case 5:
            nextpage = "shortAnswerItem";
            break;
        case 6:
            nextpage = "fileUploadItem";
            break;
        case 7:
            nextpage = "audioRecItem";
            // Set default values
            item.setTimeAllowed("30");
            item.setNumAttempts("9999");
            break;
        case 8:
            nextpage = "fillInBlackItem";
            break;
        case 11:
            nextpage = "fillInNumericItem";
            break;
        case 13:
            nextpage = "matrixChoicesSurveyItem";
            break;
        case 14:
            nextpage = "emiItem";
            break;

        case 9:
            MatchItemBean matchitem = new MatchItemBean();

            item.setCurrentMatchPair(matchitem);
            item.setMatchItemBeanList(new ArrayList());
            nextpage = "matchingItem";
            break;
        case 15: // CALCULATED_QUESTION
            CalculatedQuestionBean bean = new CalculatedQuestionBean();
            item.setCalculatedQuestion(bean);
            nextpage = "calculatedQuestionVariableItem";
            break;
        case 16: // IMAGEMAP_QUESTION
            ImageMapItemBean imgbean = new ImageMapItemBean();
            item.setImageMapItemBeanList(new ArrayList());
            nextpage = "imageMapItem";
            break;
        case 10:
            QuestionPoolBean qpoolBean = (QuestionPoolBean) ContextUtil.lookupBean("questionpool");
            qpoolBean.setImportToAuthoring(true);
            nextpage = "poolList";

            // set the current part for question copying
            String partNo = itemauthorbean.getInsertToSection();
            List<SectionContentsBean> sections = assessmentBean.getSections();
            for (SectionContentsBean content : sections) {
                if (partNo != null && partNo.equals(content.getNumber())) {
                    qpoolBean.setSelectedSection(content.getSectionId());
                    break;
                }
            }

            break;
        case 100:
            ToolSession currentToolSession = SessionManager.getCurrentToolSession();
            currentToolSession.setAttribute("QB_insert_possition", itemauthorbean.getInsertPosition());
            currentToolSession.setAttribute("QB_assessemnt_id", assessmentBean.getAssessmentId());
            currentToolSession.setAttribute("QB_assessemnt_sections", itemauthorbean.getSectionList());
            currentToolSession.setAttribute("QB_insert_section", itemauthorbean.getInsertToSection());
            nextpage = "searchQuestionBank";
            break;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
        throw e;
    }

    // check for metadata settings
    if ("assessment".equals(itemauthorbean.getTarget())) {
        AssessmentService assessdelegate = new AssessmentService();
        AssessmentFacade assessment = assessdelegate.getAssessment(assessmentBean.getAssessmentId());
        itemauthorbean.setShowMetadata(assessment.getHasMetaDataForQuestions());
        itemauthorbean.setShowFeedbackAuthoring(assessment.getShowFeedbackAuthoring());

        // set section

        if (itemauthorbean.getInsertToSection() != null) {
            // for inserting an item, this should be sequence, e.g. 1, 2, ...etc
            String sectionid = (assessment.getSection(new Long(itemauthorbean.getInsertToSection())))
                    .getSectionId().toString();
            item.setSelectedSection(sectionid);
        } else {
            // modify items, change type, will take you here.
            item.setSelectedSection(currsection);
        }

        // reset insertToSection to null;
        //itemauthorbean.setInsertToSection(null);

    } else {
        // for question pool , always show metadata as default
        itemauthorbean.setShowMetadata("true");
    }

    // set outcome for action
    itemauthorbean.setOutcome(nextpage);
    return true;

}

From source file:xiaofei.library.datastorage.database.DbCache.java

private void operateDb(final Runnable runnable, final boolean needHandleException) {
    if (mDatabase == null) {
        return;/*from   w w w.  j  a va 2s. co  m*/
    }
    mExecutorService.execute(new Runnable() {
        @Override
        public void run() {
            try {
                runnable.run();
            } catch (SQLiteFullException exception) {
                if (needHandleException) {
                    // If the database is full, simply delete all the data in the database
                    // and store the data in the memory cache into the database.
                    updateAllObjects();
                }
            } catch (RuntimeException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:org.obiba.genobyte.cli.GenotypeReportCommand.java

/**
 * Executes the file loading procedure. The type and filename are extracted from the <tt>Option</tt> instance.
 * The method {@link GenotypeReport#loadFile(CliContext, File)} is called on the appropriate instance. If no such instance
 * exists, an error message is printed on the {@link CliContext#getOutput()} stream.
 *//* www  .  j  av a2  s .  co  m*/
public boolean execute(Option opt, CliContext context) throws ParseException {
    String args[] = opt.getValues();
    if (args == null || args.length == 0) {
        context.getOutput().println(
                "Missing argument to genotype report command. Please specify the type of report to obtain.");
        return false;
    }
    String type = args[0];

    GenotypeReport r = null;
    for (GenotypeReport report : reports_) {
        if (report.getReportType().equalsIgnoreCase(type)
                || (type.length() == 1 && report.getShortReportType() == type.charAt(0))) {
            r = report;
            break;
        }
    }

    if (r == null) {
        context.getOutput()
                .println("There is no genotype report registered for the type [" + type + "] specified.");
        return false;
    }

    int filesToOutput = r.getNumberOfOutputFiles();
    File[] outputFiles = new File[filesToOutput];
    Set<String> filenames = new TreeSet<String>();
    for (int i = 0; i < filesToOutput; i++) {
        String filename = r.getDefaultFileName(i);

        // Find user specified filename
        int found = 0;
        for (int j = 1; j < args.length; j++) {
            // Iterate on all arguments until we find a parameter that is not a query reference and that is the ith filename found.
            if (context.getHistory().isQueryReference(args[j]) == false && i == found++) {
                filename = args[j];
            }
        }

        // No filename specified by report nor by user: generate one
        if (filename == null) {
            filename = r.getReportType() + "-file" + i + ".txt";
        }
        if (filenames.add(filename) == false) {
            context.getOutput().println("The filename [" + filename
                    + "] is already used as an output for this report. Please specify disctinct filenames for each output file.");
            return false;
        }
        outputFiles[i] = new File(filename);

        if (outputFiles[i].exists() && outputFiles[i].canWrite() == false) {
            context.getOutput().println("Cannot write to file [" + filename + "].");
            return false;
        }
    }

    GenotypingRecordStore<?, ?, ?> assays = context.getStore().getAssayRecordStore();
    GenotypingRecordStore<?, ?, ?> samples = context.getStore().getSampleRecordStore();

    QueryResult assayMask = new BitVectorQueryResult(assays.getStore().all());
    QueryResult sampleMask = new BitVectorQueryResult(samples.getStore().all());
    for (int i = 1; i < args.length; i++) {
        String arg = args[i];
        if (context.getHistory().isQueryReference(arg) == true) {
            QueryExecution qe = context.getHistory().resolveQuery(arg);
            if (qe != null && qe.getStore() == assays) {
                assayMask = qe.getResult();
            } else if (qe != null && qe.getStore() == samples) {
                sampleMask = qe.getResult();
            }
        }
    }

    context.getOutput()
            .println("Creating [" + r.getReportType() + "] report on " + sampleMask.count() + " samples and "
                    + assayMask.count() + " assays. Outputing report to file(s) "
                    + Arrays.toString(outputFiles));
    try {
        r.generateReport(context.getStore(), sampleMask, assayMask, outputFiles);
    } catch (RuntimeException e) {
        context.getOutput().println(
                "An unexpected error occured while generating the report. The reported error message was: "
                        + e.getMessage());
        e.printStackTrace();
    }

    return false;
}

From source file:com.gs.obevo.db.impl.core.changetypes.CsvStaticDataDeployer.java

/**
 * Note - we still need the PhysicalSchema object, as the schema coming from sybase may still have "dbo" there.
 * Until we abstract this in the metadata API, we go w/ the signature as is
 *
 * Also - this can be overridable in case we want to support bulk-inserts for specific database types,
 * e.g. Sybase IQ// w ww . j  a v  a 2  s.  co  m
 *
 * We only use batching for "executeInserts" as that is the 90% case of the performance
 * (updates may vary the kinds of sqls that are needed, and deletes I'd assume are rare)
 */
protected void executeInserts(Connection conn, StaticDataChangeRows changeRows) {
    if (changeRows.getInsertRows().isEmpty()) {
        return;
    }

    StaticDataInsertRow changeFormat = changeRows.getInsertRows().getFirst();

    String[] paramValMarkers = new String[changeFormat.getInsertColumns().size()];
    Arrays.fill(paramValMarkers, "?");
    MutableList<String> insertValues = Lists.mutable.with(paramValMarkers);

    String sql = "INSERT INTO " + dbPlatform.getSchemaPrefix(changeRows.getSchema())
            + changeRows.getTable().getName() + changeFormat.getInsertColumns().makeString("(", ", ", ")")
            + " VALUES " + insertValues.makeString("(", ", ", ")");
    LOG.info("Executing the insert " + sql);

    // TODO parameterize this chunk value - sybase sometimes cannot take a large chunk
    for (RichIterable<StaticDataInsertRow> chunkInsertRows : changeRows.getInsertRows().chunk(25)) {
        final Object[][] paramArrays = new Object[chunkInsertRows.size()][];
        chunkInsertRows.forEachWithIndex(new ObjectIntProcedure<StaticDataInsertRow>() {
            @Override
            public void value(StaticDataInsertRow insert, int i) {
                MutableList<Object> paramVals = insert.getParamVals();
                paramArrays[i] = paramVals.toArray(new Object[0]);
            }
        });

        if (LOG.isDebugEnabled()) {
            LOG.debug("for " + paramArrays.length + " rows with params: " + Arrays.deepToString(paramArrays));
        }
        try {
            this.jdbcTemplate.batchUpdate(conn, sql, paramArrays);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
}

From source file:com.stormpath.tooter.controller.SignUpController.java

@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("customer") User user, ModelMap model, BindingResult result,
        SessionStatus status) {//from  ww  w. j  a va2 s.  c om

    singUpValidator.validate(user, result);

    Map<String, String> groupMap = null;

    try {

        if (result.hasErrors()) {

            model.addAttribute("ADMINISTRATOR_URL", administratorGroupURL);
            model.addAttribute("PREMIUM_URL", premiumGroupURL);
            setGroupsToModel(groupMap, model);

            return "signUp";
        }

        String userName = user.getFirstName().toLowerCase() + user.getLastName().toLowerCase();

        // For account creation, we should get an instance of Account from the DataStore,
        // set the account properties and create it in the proper directory.
        Account account = stormpath.getDataStore().instantiate(Account.class);
        account.setEmail(user.getEmail());
        account.setGivenName(user.getFirstName());
        account.setSurname(user.getLastName());
        account.setPassword(user.getPassword());
        account.setUsername(userName);

        // Saving the account to the Directory where the Tooter application belongs.
        Directory directory = stormpath.getDirectory();
        directory.createAccount(account);

        if (user.getGroupUrl() != null && !user.getGroupUrl().isEmpty()) {
            account.addGroup(stormpath.getDataStore().getResource(user.getGroupUrl(), Group.class));
        }

        user.setUserName(userName);
        customerDao.saveCustomer(user);

        status.setComplete();

    } catch (RuntimeException re) {

        model.addAttribute("ADMINISTRATOR_URL", administratorGroupURL);
        model.addAttribute("PREMIUM_URL", premiumGroupURL);
        setGroupsToModel(groupMap, model);

        result.addError(new ObjectError("password", re.getMessage()));
        re.printStackTrace();
        return "signUp";

    } catch (Exception e) {
        e.printStackTrace();
    }

    //form success
    return "redirect:/login/message?loginMsg=registered";
}

From source file:org.eclipsetrader.yahoo.internal.core.connector.StreamingConnector.java

protected Map<String, String> parseScript(String script) {
    Map<String, String> map = new HashMap<String, String>();

    int e = 0;/* w ww.  jav a  2s .co m*/
    int s = script.indexOf("unixtime");
    if (s != -1) {
        s += 10;
        e = script.indexOf(',', s);
        if (e == -1) {
            e = script.indexOf('}', s);
        }
        map.put("unixtime", script.substring(s, e));
    }

    s = script.indexOf("open");
    if (s != -1) {
        s += 6;
        e = script.indexOf(',', s);
        if (e == -1) {
            e = script.indexOf('}', s);
        }
        map.put("open", script.substring(s, e));
    }

    s = script.indexOf("close");
    if (s != -1) {
        s += 7;
        e = script.indexOf(',', s);
        if (e == -1) {
            e = script.indexOf('}', s);
        }
        map.put("close", script.substring(s, e));
    }

    s = script.indexOf('"', e);
    if (s != -1) {
        s++;
        e = script.indexOf('"', s);
        String symbol = script.substring(s, e);
        map.put(K_SYMBOL, symbol);

        boolean inExpression = false;
        boolean inValue = false;
        int vs = -1;
        int ve = -1;
        for (int i = e + 1; i < script.length(); i++) {
            char ch = script.charAt(i);
            if (inExpression) {
                if (ch == ':') {
                    e = i;
                }
                if (ch == '"') {
                    inValue = !inValue;
                    if (inValue) {
                        vs = i + 1;
                    } else {
                        ve = i;
                        try {
                            String key = script.substring(s, e);
                            String value = script.substring(vs, ve);
                            map.put(key, value);
                        } catch (RuntimeException e1) {
                            System.err.println(script);
                            e1.printStackTrace();
                        }
                    }
                }
                if ((ch == ',' || ch == '}') && !inValue) {
                    inExpression = false;
                }
            } else {
                if (Character.isLetter(ch)) {
                    inExpression = true;
                    s = i;
                }
            }
        }
    }

    return map;
}

From source file:com.bizintelapps.promanager.service.impl.TaskServiceImpl.java

/**
 * prepares html email for task// w w w .j a  v a  2 s .c o m
 * @param task
 */
private void sendTaskAlert(Task task) {
    Set<String> to = new HashSet<String>();
    String subject = "";
    to.add(task.getOwner().getUsername());
    String assignedTo = getName(task.getAssignedTo());
    subject += (task.getAssignedTo() != null) ? task.getAssignedTo().getFirstname() + ", " : "";
    if ((task.getAssignedTo() != null)) {
        to.add(task.getAssignedTo().getUsername());
    }
    String assignedBy = getName(task.getAssignedBy());
    if (task.getAssignedBy() != null) {
        to.add(task.getAssignedBy().getUsername());
    }
    String createdBy = getName(task.getOwner());
    String project = (task.getProject() != null) ? task.getProject().getName() : "Todo";
    if (task.getNotificationEmails() != null && task.getNotificationEmails().length() > 5) {
        String[] emails = task.getNotificationEmails().split(",");
        for (String email : emails) {
            to.add(email);
        }
    }
    String id = (task.getId() != null) ? task.getId().toString() : "New";
    subject += task.getTitle();
    String assignedDate = getFormatedDate(task.getAssignedDate());
    String deadline = getFormatedDate(task.getDeadline());
    String completedDate = getFormatedDate(task.getCompletedDate());
    String body = "<table>" + "<tr><td>Task #</td><td>" + id + "</td></tr>" + "<tr><td>Summary</td><td>"
            + task.getTitle() + "</td></tr>" + "<tr><td>Assigned To</td><td>" + assignedTo + "</td></tr>"
            + "<tr><td>Assigned On</td><td>" + assignedDate + "</td></tr>" + "<tr><td>Assigned By</td><td>"
            + assignedBy + "</td></tr>" + "<tr><td>Created By</td><td>" + createdBy + "</td></tr>"
            + "<tr><td>Created On</td><td>" + getFormatedDate(task.getCreateDate()) + "</td></tr>"
            + "<tr><td>Project</td><td>" + project + "</td></tr>" + "<tr><td>Status</td><td>" + task.getStatus()
            + "</td></tr>" + "<tr><td>Priority</td><td>" + task.getPriority() + "</td></tr>"
            + "<tr><td>Estimated Time</td><td>" + task.getEstimatedHours() + "</td></tr>"
            + "<tr><td>Time Spend</td><td>" + task.getSpendHours() + "</td></tr>" + "<tr><td>Finish By</td><td>"
            + deadline + "</td></tr>" + "<tr><td>Completed On</td><td>" + completedDate + "</td></tr>"
            + "<tr><td>Description</td><td>" + task.getDescription() + "</td></tr>" + "</table>";
    try {
        String[] tos = new String[1];
        tos = to.toArray(tos);
        mailSender.sendMail(tos, subject, body);
    } catch (RuntimeException re) {
        re.printStackTrace();
    }
}

From source file:org.sakaiproject.tool.assessment.ui.listener.evaluation.SubmissionStatusListener.java

/**
 * This will populate the SubmissionStatusBean with the data associated with the
 * particular versioned assessment based on the publishedId.
 *
 * @todo Some of this code will change when we move this to Hibernate persistence.
 * @param publishedId String//  www  .  j a  v  a  2s. c  o m
 * @param bean SubmissionStatusBean
 * @return boolean
 */
public boolean submissionStatus(String publishedId, SubmissionStatusBean bean, TotalScoresBean totalScoresBean,
        boolean isValueChange) {
    log.debug("submissionStatus()");
    try {
        TotalScoreListener totalScorelistener = new TotalScoreListener();

        GradingService delegate = new GradingService();

        if (ContextUtil.lookupParam("sortBy") != null && !ContextUtil.lookupParam("sortBy").trim().equals(""))
            bean.setSortType(ContextUtil.lookupParam("sortBy"));

        boolean sortAscending = true;
        if (ContextUtil.lookupParam("sortAscending") != null
                && !ContextUtil.lookupParam("sortAscending").trim().equals("")) {
            sortAscending = Boolean.valueOf(ContextUtil.lookupParam("sortAscending")).booleanValue();
            bean.setSortAscending(sortAscending);
            log.debug("submissionStatus() :: sortAscending = " + sortAscending);
        }

        totalScoresBean.setSelectedSectionFilterValue(bean.getSelectedSectionFilterValue());

        bean.setPublishedId(publishedId);

        // we are only interested in showing last submissions

        List scores = delegate.getLastSubmittedAssessmentGradingList(new Long(publishedId));
        ArrayList agents = new ArrayList();
        Iterator iter = scores.iterator();
        if (!iter.hasNext()) {
            // this section has no students
            bean.setAgents(agents);
            bean.setAllAgents(agents);
            bean.setTotalPeople(Integer.toString(bean.getAgents().size()));
            return true;
        }

        Object next = iter.next();
        //Date dueDate = null;

        // Collect a list of all the users in the scores list
        Map useridMap = totalScoresBean.getUserIdMap(TotalScoresBean.CALLED_FROM_SUBMISSION_STATUS_LISTENER);

        ArrayList agentUserIds = totalScorelistener.getAgentIds(useridMap);
        AgentHelper helper = IntegrationContextFactory.getInstance().getAgentHelper();
        Map userRoles = helper.getUserRolesFromContextRealm(agentUserIds);

        // Okay, here we get the first result set, which has a summary of
        // information and a pointer to the graded assessment we should be
        // displaying.  We get the graded assessment.
        AssessmentGradingData data = (AssessmentGradingData) next;
        PublishedAssessmentService pubService = new PublishedAssessmentService();
        PublishedAssessmentIfc pub = (PublishedAssessmentIfc) pubService
                .getPublishedAssessment(data.getPublishedAssessmentId().toString());
        if (pub != null) {
            bean.setAssessmentName(pub.getTitle());
        }

        if (ContextUtil.lookupParam("roleSelection") != null) {
            bean.setRoleSelection(ContextUtil.lookupParam("roleSelection"));
        }

        if (bean.getSortType() == null) {
            bean.setSortType("agentEid");
        }

        /* Dump the grading and agent information into AgentResults */
        ArrayList students_submitted = new ArrayList();
        iter = scores.iterator();
        HashMap studentGradingSummaryDataMap = new HashMap();
        RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil
                .lookupBean("retakeAssessment");
        while (iter.hasNext()) {
            AgentResults results = new AgentResults();
            AssessmentGradingData gdata = (AssessmentGradingData) iter.next();
            gdata.setItemGradingSet(new HashSet());
            BeanUtils.copyProperties(results, gdata);

            results.setAssessmentGradingId(gdata.getAssessmentGradingId());
            String agentid = gdata.getAgentId();
            AgentFacade agent = new AgentFacade(agentid);
            results.setLastName(agent.getLastName());
            results.setFirstName(agent.getFirstName());
            results.setEmail(agent.getEmail());
            if (results.getLastName() != null && results.getLastName().length() > 0)
                results.setLastInitial(results.getLastName().substring(0, 1));
            else if (results.getFirstName() != null && results.getFirstName().length() > 0)
                results.setLastInitial(results.getFirstName().substring(0, 1));
            else
                results.setLastInitial("A");
            results.setIdString(agent.getIdString());
            results.setAgentEid(agent.getEidString());
            results.setAgentDisplayId(agent.getDisplayIdString());
            results.setRole((String) userRoles.get(agentid));
            results.setRetakeAllowed(
                    getRetakeAllowed(agent.getIdString(), studentGradingSummaryDataMap, retakeAssessment));
            if (useridMap.containsKey(agentid)) {
                agents.add(results);
                students_submitted.add(agentid);
            }
        }
        retakeAssessment.setStudentGradingSummaryDataMap(studentGradingSummaryDataMap);

        ArrayList students_not_submitted = new ArrayList();
        Iterator useridIterator = useridMap.keySet().iterator();
        while (useridIterator.hasNext()) {
            String userid = (String) useridIterator.next();
            if (!students_submitted.contains(userid)) {
                students_not_submitted.add(userid);
            }
        }
        prepareNotSubmittedAgentResult(students_not_submitted.iterator(), agents, userRoles, retakeAssessment,
                studentGradingSummaryDataMap);
        bs = new BeanSort(agents, bean.getSortType());
        if ((bean.getSortType()).equals("assessmentGradingId")) {
            bs.toNumericSort();
        } else {
            bs.toStringSort();
        }

        if (sortAscending) {
            log.debug("TotalScoreListener: setRoleAndSortSection() :: sortAscending");
            agents = (ArrayList) bs.sort();
        } else {
            log.debug("TotalScoreListener: setRoleAndSortSection() :: !sortAscending");
            agents = (ArrayList) bs.sortDesc();
        }

        bean.setAgents(agents);
        bean.setAllAgents(agents);
        bean.setTotalPeople(Integer.toString(bean.getAgents().size()));
    }

    catch (RuntimeException e) {
        e.printStackTrace();
        return false;
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        return false;
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return false;
    }

    return true;
}