Skip to content

Commit

Permalink
Revert "relax validation on the presence of the 'shouldRetry' field w…
Browse files Browse the repository at this point in the history
…hen there (#17)"

This reverts commit 725dcef.
  • Loading branch information
bbaldino committed Jan 22, 2020
1 parent 725dcef commit 9a12d81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/jitsi/xmpp/extensions/jibri/JibriIq.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,13 @@ protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildE
xml.optAttribute(SIP_ADDRESS_ATTR_NAME, sipAddress);
xml.optAttribute(SESSION_ID_ATTR_NAME, sessionId);
xml.optAttribute(FAILURE_REASON_ATTR_NAME, failureReason);
xml.attribute(SHOULD_RETRY_ATTR_NAME, shouldRetry);
if (failureReason != null && failureReason != FailureReason.UNDEFINED) {
if (shouldRetry == null) {
throw new RuntimeException("shouldRetry field must be filled " +
"out when a failure reason is set");
}
xml.attribute(SHOULD_RETRY_ATTR_NAME, shouldRetry);
}
xml.optAttribute(APP_DATA_ATTR_NAME, appData);

xml.setEmptyElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public JibriIq parse(XmlPullParser parser, int depth)
{
iq.setShouldRetry(Boolean.valueOf(shouldRetryStr));
}
else if (iq.getFailureReason() != null
&& iq.getFailureReason() != JibriIq.FailureReason.UNDEFINED)
{
throw new RuntimeException("shouldRetry must be set if a " +
"failure reason is given");
}

String displayName
= parser.getAttributeValue("", JibriIq.DISPLAY_NAME_ATTR_NAME);
Expand Down

0 comments on commit 9a12d81

Please sign in to comment.