我正在使用 JODConverter 将 .xls 和 .ppt 转换为 .pdf 格式。为此,我有类似的代码
try{
//do something
System.out.println("connecting to open office");
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
System.out.println("connection object created");
connection.connect();
System.out.println("connection to open office successful");
//do something
if(!successful)
throw new FileNotFoundException();
}catch(Exception e){
System.out.println("hello here");
System.out.println("Caught Exception while converting to PDF ");
LOGGER.error("Error in converting media" + e.getMessage());
throw new MediaConversionFailedException();
}finally{
decode_pdf.closePdfFile();
System.out.println("coming in finally");
//do something here
}
我的输出:
connecting to open office
connection object created
coming in finally
PS返回方法的类型是void
这怎么可能 ?即使connection.connect() 中存在一些问题,它也会出现在catch 块中。使困惑