Niklas Gustavsson wrote:
> On Thu, Jul 9, 2009 at 11:48 PM, Niklas Gustavsson<[email protected]>
> wrote:
>> This also seems to agree with some examples from RFC 3920, for example here:
>> http://xmpp.org/rfcs/rfc3920.html#bind
I cannot emphasize enough that the examples are not normative. In fact,
they often contain errors.
Nevertheless, I agree that I cannot find an example where the error
stanza contains the original.
That's the related section in RFC3920 which is implemented currently:
>>>>
9.3.1. Rules
The following rules apply to stanza-related errors:
o <ommitted/>
o The entity that generates an error stanza SHOULD include the
original XML sent so that the sender can inspect and, if
necessary, correct the XML before attempting to resend.
<<<<
I interpret "the original XML" as "the original stanza", because
everything else would making this inspection difficult.
I don't think what we return right now is too much or inconsistent, but
I don't want to be a bonehead. ;-)
What would be our motivation to change this behaviour?
Bernd
>
> Here's a proposed patch for this:
> Index:
> src/main/java/org/apache/vysper/xmpp/server/response/ServerErrorResponses.java
> ===================================================================
> ---
> src/main/java/org/apache/vysper/xmpp/server/response/ServerErrorResponses.java
> (revision
> 791956)
> +++
> src/main/java/org/apache/vysper/xmpp/server/response/ServerErrorResponses.java
> (working
> copy)
> @@ -104,7 +104,6 @@
> }
>
> StanzaBuilder responseBuilder =
> StanzaBuilder.createDirectReply(stanza, true, "error");
> -
> fillErrorStanza(stanza, type, errorCondition, errorText,
> errorLang, errorConditionElement, responseBuilder);
>
> return responseBuilder.getFinalStanza();
> @@ -112,7 +111,9 @@
>
> private void fillErrorStanza(XMPPCoreStanza stanza,
> StanzaErrorType type, StanzaErrorCondition errorCondition, String
> errorText, String errorLang, XMLElement errorConditionElement,
> StanzaBuilder responseBuilder) {
> // inline incoming stanza as of RFC 3920 9.3.1
> - responseBuilder.addPreparedElement(stanza);
> + for(XMLElement innerElement : stanza.getInnerElements()) {
> + responseBuilder.addPreparedElement(innerElement);
> + }
>
> // error element
> responseBuilder.startInnerElement("error")
>
>
> /niklas
>