Waikato / meka

Multi-label classifiers and evaluation procedures using the Weka machine learning framework.
http://waikato.github.io/meka/
GNU General Public License v3.0
200 stars 76 forks source link

Can you replicate the error and post the steps that cause this? #64

Closed cah-arti-deshpande closed 4 years ago

cah-arti-deshpande commented 4 years ago

public void doSelect(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

    JSONObject json = new JSONObject();     

    String lineNumberParam = request.getParameter("lineNum");
    long lineNumber = (new Long(lineNumberParam).longValue());

    String parentRowParam = request.getParameter("parentRow");
    long parentRow = 0;
    if (!ValueUtils.isNullOrEmpty(parentRowParam))
        parentRow = (new Long(parentRowParam).longValue());

    String checkedParam = request.getParameter("checked");
    if (checkedParam == null)
        return;

    boolean checked = ("1".equals(checkedParam));

    ProposalHeader hdr = (ProposalHeader) request.getSession()
            .getAttribute(SESSION_PROPOSAL_HDR);
    if (hdr == null) {
        json.put("success", false);
        json.put("message", "Unable to find the proposal in the session.  Please retrieve it again from the Saved Proposal Listing");
        response.getWriter().println(json.toString());
        response.flushBuffer();
        return;
    }

    final ProposalManager manager = new ProposalManager();
    boolean success = true;

    if (parentRow == 0) {
        if (lineNumber == -1) {
            // Select all on the page.
            ProposalResultsStateHelper stateHelper = (ProposalResultsStateHelper) request
                    .getSession().getAttribute(SESSION_PROPOSAL_RESULTS_STATE);
            for (int i = stateHelper.getLowerRecordNumber() - 1; i < stateHelper
                    .getUpperRecordNumber(); i++) {
                ProposalDetail dto = (ProposalDetail) hdr.getDetails().get(i);
                dto.setSelected(checked);
            }

        } else {
            int atIndex = manager.getDetailLineIndex(hdr.getDto(), lineNumber);
            if (atIndex >= 0) {
                ProposalDetail dtoDetail = (ProposalDetail) hdr.getDetails().get(atIndex);
                dtoDetail.setSelected(checked);
            } else {
                success = false;
                json.put("message", "Unable to find the selected line.  Please retrieve the proposal again from the Saved Proposal Listing");
            }
        }

    } else {
        int atIndex = manager.getDetailLineIndex(hdr.getDto(), parentRow);
        if (atIndex >= 0) {
            ProposalDetail dtoDetail = (ProposalDetail) hdr.getDetails().get(atIndex);

            if (lineNumber == -1) {
                //Select all sub-items
                for (Iterator iter = dtoDetail.getSubItems().iterator(); iter.hasNext();) {
                    ProposalDetail dto = (ProposalDetail) iter.next();
                    dto.setSelected(checked);
                }

            } else {
                int subIndex = manager.getDetailLineIndex(dtoDetail.getSubItems(), lineNumber);
                if (subIndex < 0) {
                    return;
                }
                ProposalDetail dto = (ProposalDetail) dtoDetail.getSubItems().get(subIndex);
                dto.setSelected(checked);
            }
        } else {
            success = false;
            json.put("message", "Unable to find the selected line.  Please retrieve the proposal again from the Saved Proposal Listing");
        }

    }

    request.getSession().setAttribute(SESSION_PROPOSAL_HDR, hdr);

    json.put("success", success);
    response.getWriter().println(json.toString());
    response.flushBuffer();
}
fracpete commented 4 years ago

This is not a MEKA related issue/question, hence it will get closed.