I found the following bug in line 252 of ImageCommand.java there is no check if iErrorText is null:

  protected void finished(int pReturnCode) throws Exception {
        if (pReturnCode > 0) {
            CommandException ce;
            if (iErrorText.size() > 0) { // <-- NullPointer
                ce = new CommandException(iErrorText.get(0)); // <-- partial error message
            } else {
                ce = new CommandException("return code: " + pReturnCode);
            }
            ce.setErrorText(iErrorText);
            ce.setReturnCode(pReturnCode);
            throw ce;
        } else {
            removeTmpFiles();
        }
    }

I solved it as follows:

    protected void finished(int pReturnCode) throws Exception {
        if (pReturnCode > 0) {
            CommandException ce;
            if (iErrorText != null && iErrorText.size() > 0) {
                ce = new CommandException(String.join(",", iErrorText));
            } else {
                ce = new CommandException("return code: " + pReturnCode);
            }
            ce.setErrorText(iErrorText);
            ce.setReturnCode(pReturnCode);
            throw ce;
        } else {
            removeTmpFiles();
        }
    }

Can you integrate this solution into your library?

 

Last edit: gabriele favaretto 2017-10-24