You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/05/07 16:11:16 UTC
DO NOT REPLY [Bug 19726] -
AttachmentPart getContent does not comply with JAXM standards
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19726>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19726
AttachmentPart getContent does not comply with JAXM standards
------- Additional Comments From apache@dreamtimesolutions.com 2003-05-07 14:11 -------
Sorry, I chopped out a very important line in getContent with my cut & paste
(there were two fixes required) the entire getContent method reads like this:
public Object getContent() throws SOAPException {
if(contentObject != null) {
return contentObject;
}
if(datahandler == null) {
throw new SOAPException(Messages.getMessage("noContent"));
}
javax.activation.DataSource ds = datahandler.getDataSource();
// Fix the URLDataSource was missing
if ((ds instanceof ManagedMemoryDataSource) || (ds instanceof
URLDataSource)) {
if (ds.getContentType().equals("text/plain")) {
try {
java.io.InputStream is = ds.getInputStream();
byte[] bytes = new byte[is.available()];
is.read(bytes);
return new String(bytes);
} catch (java.io.IOException io) {
log.error(Messages.getMessage("javaIOException00"), io);
}
} else {
// Fix this else clause was missing
try {
return ds.getInputStream();
} catch (java.io.IOException io) {
log.error(Messages.getMessage("javaIOException00"), io);
}
}
}
return null;
}