// the OutputMunger strips off the XMLEncoder header
OutputMunger bos = new OutputMunger( out);
PrintWriter pw = new PrintWriter( bos);
XMLEncoder beanEncoder = new XMLEncoder( bos);
beanEncoder.setExceptionListener(new ExceptionListener() {
public void exceptionThrown(Exception exception) {
System.out.println("XMLStore.save() got Exception: abort saving the preferences!");
exception.printStackTrace();
outputExceptionMessage = exception.getMessage();
}