if (pobjVirtualFile != null) {
OutputStream objOutputStream = pobjVirtualFile.getFileOutputStream();
try {
if (objOutputStream == null) {
logger.error(String.format("can't get outputstream for file '%1$s'.", pobjVirtualFile.getName()));
throw new JobSchedulerException(String.format("can't get outputstream for file '%1$s'.", pobjVirtualFile.getName()));
}
// get an Apache XMLSerializer configured to generate CDATA
XMLSerializer serializer = getXMLSerializer();
serializer.setOutputByteStream(objOutputStream);
// marshal using the Apache XMLSerializer
objM.marshal(objO, serializer.asContentHandler());
}
catch (JAXBException e) {
e.printStackTrace();
throw new JobSchedulerException("", e);
}
catch (IOException e) {
e.printStackTrace();
throw new JobSchedulerException("", e);
}
finally {
pobjVirtualFile.closeOutput();
}
}
else {
logger.error("pobjVirtualFile is null");
throw new JobSchedulerException("pobjVirtualFile is null");
}
return objO;
} // private SchedulerObjectFactoryOptions marshal