From 2ba84bd32e268facf8c8d1bdcb740c4469f9078d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 10 Apr 2020 07:53:29 +0200 Subject: [PATCH] no need to be careful about Int parsing in session description; just fail --- .../siacs/conversations/xmpp/jingle/JingleRtpConnection.java | 4 ++-- .../siacs/conversations/xmpp/jingle/SessionDescription.java | 3 +++ .../conversations/xmpp/jingle/stanzas/RtpDescription.java | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index 946d021ab..52e595b99 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -249,7 +249,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web final SessionDescription sessionDescription; try { 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); webRTCWrapper.close(); sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage()); @@ -276,7 +276,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web final SessionDescription offer; try { 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); webRTCWrapper.close(); sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage()); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java index 587fb513c..f6f12513d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java @@ -137,6 +137,9 @@ public class SessionDescription { attributeMap.put("msid-semantic", " WMS my-media-stream"); for (Map.Entry entry : contentMap.contents.entrySet()) { + + //TODO sprinkle in a few noWhiteSpaces checks into various parameters and types + final String name = entry.getKey(); RtpContentMap.DescriptionTransport descriptionTransport = entry.getValue(); RtpDescription description = descriptionTransport.description; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java index 59881b089..00b2ddc60 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java @@ -145,10 +145,7 @@ public class RtpDescription extends GenericDescription { public int getValue() { final String value = getAttribute("value"); - if (value == null) { - return 0; - } - return SessionDescription.ignorantIntParser(value); + return Integer.parseInt(value); }