Spring oxm 在 catch 语句附近获取类型转换错误
我在 catch 语句附近遇到错误 Error : required java.lang.Throwabe found 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);
}
}
I am getting error near catch statement Error : required java.lang.Throwabe found 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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
catch 语句参数中不允许进行类型转换。
Type casting is not allowed in catch statement argument.