简体   繁体   English

为什么我的插件中的Webwork方法回落到JIRA的ActionSupport类中?

[英]Why does a Webwork method in my plugin fall back into JIRA's ActionSupport class?

I am having troubles with an Excel File uploaded into a Webwork Action class in my JIRA plugin. 我在JIRA插件中将Excel文件上传到Webwork Action类时遇到麻烦。 I am using apache.poi to manipulate the Excel file as follows: 我正在使用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
    }

}

When the code gets to the line: 当代码到达该行时:

workbook = new HSSFWorkbook(filestrem);

I am kicked out of the class to a class called ActionSupport from JIRA, but with no errors or stacktraces to guide me. 我从JIRA被踢出了一个名为ActionSupport的类,但没有错误或堆栈跟踪来指导我。

Am I missing something? 我想念什么吗? It there something wrong? 它有什么问题吗? :( :(

Thanks in advance for any insights on this issue. 预先感谢您对这个问题的任何见解。

The underlying library is probably throwing some sort of unchecked exception. 基础库可能会抛出某种未经检查的异常。 To debug, try changing: 要调试,请尝试更改:

catch (IOException e)

to: 至:

catch (Throwable e)

and then set a breakpoint on the e.printStackTrace() line. 然后在e.printStackTrace()行上设置一个断点。

(Or wrap the whole method in the try/catch block if you're not 100% sure of exactly where it's crashing.) (或者,如果您不能100%确定崩溃的确切位置,则将整个方法包装在try / catch块中。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM