【问题标题】:Why does a Webwork method in my plugin fall back into JIRA's ActionSupport class?为什么我的插件中的 Webwork 方法会退回到 JIRA 的 ActionSupport 类?
【发布时间】:2014-10-09 16:57:49
【问题描述】:

我在将 Excel 文件上传到我的 JIRA 插件中的 Webwork Action 类时遇到问题。 我正在使用 apache.poi 来操作 Excel 文件,如下所示:

public class ExcelWebworkAction extends JiraWebActionSupport
{
    private static final long serialVersionUID = -7589391189615316463L;
    private static final Logger log = LoggerFactory.getLogger(ExcelWebworkAction.class);

    @Override
    public String doExecute() throws Exception {
        MultiPartRequestWrapper wrapper = (MultiPartRequestWrapper)ServletActionContext.getRequest();
        File file = wrapper.getFile("fileField");
        FileInputStream filestrem = new FileInputStream(file.getPath());

        HSSFWorkbook workbook = null;

        try {
            workbook = new HSSFWorkbook(filestrem);
        } catch (IOException e) {
            e.printStackTrace();
        }

        HSSFSheet sheet = workbook.getSheetAt(0);
        Iterator<Row> rowIterator = sheet.iterator();
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            Iterator<Cell> cellIterator = row.cellIterator();
            while (cellIterator.hasNext()) {
                Cell cell = cellIterator.next();
            }
        }

        filestrem.close();

        return super.doExecute(); //returns SUCCESS
    }

}

当代码到达该行时:

workbook = new HSSFWorkbook(filestrem);

我被 JIRA 踢出了一个名为 ActionSupport 的班级,但没有任何错误或堆栈跟踪可以指导我。

我错过了什么吗?它有什么问题吗? :(

提前感谢您对此问题的任何见解。

【问题讨论】:

    标签: java excel jira jira-plugin jira-rest-api


    【解决方案1】:

    底层库可能会抛出某种未经检查的异常。要调试,请尝试更改:

    catch (IOException e)
    

    到:

    catch (Throwable e)
    

    然后在e.printStackTrace() 行设置断点。

    (如果您不能 100% 确定它崩溃的确切位置,或者将整个方法包装在 try/catch 块中。)

    【讨论】:

    • 嗨,Scott,感谢您抽出宝贵时间研究此问题。是的,就是这样,现在我有一个错误要调查! :) 某些类未正确加载。非常感谢! :)
    猜你喜欢
    • 2012-10-06
    • 1970-01-01
    • 1970-01-01
    • 2015-07-27
    • 1970-01-01
    • 1970-01-01
    • 2013-07-17
    • 1970-01-01
    • 2020-12-05
    相关资源
    最近更新 更多