} else {
throw new Fault(new org.apache.cxf.common.i18n.Message("ATTACHMENT_NOT_SUPPORTED",
LOG, ct));
}
dh = new DataHandler(new ByteDataSource(bos.toByteArray(), ct));
} else if (o instanceof DataHandler) {
dh = (DataHandler) o;
ct = dh.getContentType();
try {
if ("text/xml".equals(ct)
&& dh.getContent() instanceof Source) {
dh = new DataHandler(createDataSource((Source)dh.getContent(), ct));
}
} catch (IOException e) {
//ignore, use same dh
}
} else if (o instanceof byte[]) {
if (ct == null) {
ct = "application/octet-stream";
}
dh = new DataHandler(new ByteDataSource((byte[])o, ct));
} else if (o instanceof String) {
if (ct == null) {
ct = "text/plain; charset=\'UTF-8\'";
}
try {
dh = new DataHandler(new ByteDataSource(((String)o).getBytes("UTF-8"), ct));
} catch (IOException e) {
throw new Fault(e);
}
} else {
throw new Fault(new org.apache.cxf.common.i18n.Message("ATTACHMENT_NOT_SUPPORTED",