为什么我的插件中的Webwork方法会回落到JIRA的ActionSupport类中?
我有一个Excelfile upload到我的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
的类,但没有错误或堆栈跟踪指导我。
我错过了什么吗? 有什么不对吗? 🙁
提前感谢有关这个问题的任何见解。
底层的库可能会抛出某种未经检查的exception。 要进行debugging,请尝试更改:
catch (IOException e)
至:
catch (Throwable e)
然后在e.printStackTrace()
行上设置一个断点。
(或者,如果你不完全确定它在哪里崩溃,那么把整个方法包装在try / catch块中。)