@Override JSONStreamAware processRequest(HttpServletRequest req) throws NxtException { String pollValue = req.getParameter("poll"); if (pollValue == null) { return MISSING_POLL; } Poll pollData; int numberOfOptions = 0; try { pollData = Poll.getPoll(Convert.parseUnsignedLong(pollValue)); if (pollData != null) { numberOfOptions = pollData.getOptions().length; } else return INCORRECT_POLL; } catch (RuntimeException e) { return INCORRECT_POLL; } byte[] vote = new byte[numberOfOptions]; try { for (int i = 0; i < numberOfOptions; i++) { String voteValue = req.getParameter("vote" + i); if (voteValue != null) { vote[i] = Byte.parseByte(voteValue); } } } catch (NumberFormatException e) { return INCORRECT_VOTE; } Account account = getAccount(req); if (account == null) { return UNKNOWN_ACCOUNT; } Attachment attachment = new Attachment.MessagingVoteCasting(pollData.getId(), vote); return createTransaction(req, account, attachment); }