Spring catch在catch语句附近获取类型转换错误

时间:2010-07-30 08:20:09

标签: java spring oxm

我在catch语句附近收到错误错误:需要java.lang.Throwabe找到org.springframework.oxm.XmlMappingException

enter code here public void writeObjectToXml(Object object, String filename) throws IOException {
    FileOutputStream fos = null;
    try {
        fos = new FileOutputStream(filename);
        try {
            marshaller.marshal(object, new StreamResult(fos));
        } catch (XmlMappingException xme) {
        }
        fos.close();
    } catch (Exception e) {
        System.out.println("Error :: " + e);
    }
}

1 个答案:

答案 0 :(得分:0)

catch语句参数中不允许类型转换。