0

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);
    }
}

1 Answer 1

0

Type casting is not allowed in catch statement argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.