You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "David Crossley (JIRA)" <ji...@apache.org> on 2006/03/01 07:58:41 UTC
[jira] Updated: (COCOON-988) [PATCH] StreamGenerator can't handle
multipart request parameters correctly
[ http://issues.apache.org/jira/browse/COCOON-988?page=all ]
David Crossley updated COCOON-988:
----------------------------------
Bugzilla Id: (was: 25594)
Other Info: [Patch available]
Description:
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
was:
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
> [PATCH] StreamGenerator can't handle multipart request parameters correctly
> ---------------------------------------------------------------------------
>
> Key: COCOON-988
> URL: http://issues.apache.org/jira/browse/COCOON-988
> Project: Cocoon
> Type: Bug
> Components: - Components: Sitemap
> Versions: 2.2-dev (Current SVN)
> Environment: Operating System: All
> Platform: All
> Reporter: Gernot Koller
> Assignee: Cocoon Developers Team
>
> 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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira