cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25594] New: - StreamGenerator can't handle multipart request parameters correctly
Date Wed, 17 Dec 2003 16:52:52 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=25594>.
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=25594

StreamGenerator can't handle multipart request parameters correctly

           Summary: StreamGenerator can't handle multipart request
                    parameters correctly
           Product: Cocoon 2
           Version: Current CVS 2.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: sitemap components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: grizzly@gmx.at


In the StreamGenerator class in line 140

String sXml = request.getParameter(parameter);
inputSource = new InputSource(new StringReader(sXml));

it is wrongly assumed that in case of multipart requests the xml data can 
be retrieved via the normal request.getParameter() Method. In fact this code
results in a sXml String containing something 
like "org.apache.cocoon.servlet.multipart.PartInMemory@4711" which is not the 
xml content and therefore cannot be parsed.

Instead it should read like:

Object xmlObject = request.get(parameter);
Reader  xmlReader = null;
if (xmlObject instanceof String){
  xmlReader  = new StringReader((String) xmlObject);
}
else if (xmlObject instanceof Part){
  xmlReader = new InputStreamReader(((Part) xmlObject).getInputStream());
}
else{
  throw new ProcessingException("Unknown request object encountred named " + 
parameter + " : " + xmlObject);
}
inputSource = new InputSource(xmlReader);

thx,

Gernot

Mime
View raw message