axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19726] - AttachmentPart getContent does not comply with JAXM standards
Date Wed, 07 May 2003 14:11:16 GMT
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;
    }

Mime
View raw message