no need to be careful about Int parsing in session description; just fail

This commit is contained in:
Daniel Gultsch 2020-04-10 07:53:29 +02:00
parent 6884e427ef
commit 2ba84bd32e
3 changed files with 6 additions and 6 deletions

View file

@ -249,7 +249,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
final SessionDescription sessionDescription; final SessionDescription sessionDescription;
try { try {
sessionDescription = SessionDescription.of(contentMap); sessionDescription = SessionDescription.of(contentMap);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException | NullPointerException e) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-accept to SDP", e); Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-accept to SDP", e);
webRTCWrapper.close(); webRTCWrapper.close();
sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage()); sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());
@ -276,7 +276,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
final SessionDescription offer; final SessionDescription offer;
try { try {
offer = SessionDescription.of(rtpContentMap); offer = SessionDescription.of(rtpContentMap);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException | NullPointerException e) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-initiate to SDP", e); Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-initiate to SDP", e);
webRTCWrapper.close(); webRTCWrapper.close();
sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage()); sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());

View file

@ -137,6 +137,9 @@ public class SessionDescription {
attributeMap.put("msid-semantic", " WMS my-media-stream"); attributeMap.put("msid-semantic", " WMS my-media-stream");
for (Map.Entry<String, RtpContentMap.DescriptionTransport> entry : contentMap.contents.entrySet()) { for (Map.Entry<String, RtpContentMap.DescriptionTransport> entry : contentMap.contents.entrySet()) {
//TODO sprinkle in a few noWhiteSpaces checks into various parameters and types
final String name = entry.getKey(); final String name = entry.getKey();
RtpContentMap.DescriptionTransport descriptionTransport = entry.getValue(); RtpContentMap.DescriptionTransport descriptionTransport = entry.getValue();
RtpDescription description = descriptionTransport.description; RtpDescription description = descriptionTransport.description;

View file

@ -145,10 +145,7 @@ public class RtpDescription extends GenericDescription {
public int getValue() { public int getValue() {
final String value = getAttribute("value"); final String value = getAttribute("value");
if (value == null) { return Integer.parseInt(value);
return 0;
}
return SessionDescription.ignorantIntParser(value);
} }