Merge pull request #3379 from ritzalam/fix-poll-voting

Cast Exception when sending Number from client to Red5
This commit is contained in:
Fred Dixon 2016-09-17 10:23:13 -04:00 committed by GitHub
commit e2191a0426
2 changed files with 35 additions and 7 deletions

View File

@ -59,8 +59,6 @@ public class CaptionService {
} }
public void editCaptionHistory(Map<String, Object> msg) { public void editCaptionHistory(Map<String, Object> msg) {
int startIndex = (Integer) msg.get("startIndex");
int endIndex = (Integer) msg.get("endIndex");
String locale = msg.get("locale").toString(); String locale = msg.get("locale").toString();
String localeCode = msg.get("localeCode").toString(); String localeCode = msg.get("localeCode").toString();
String text = msg.get("text").toString(); String text = msg.get("text").toString();
@ -68,6 +66,22 @@ public class CaptionService {
String meetingID = Red5.getConnectionLocal().getScope().getName(); String meetingID = Red5.getConnectionLocal().getScope().getName();
String userID = getBbbSession().getInternalUserID(); String userID = getBbbSession().getInternalUserID();
Integer startIndex;
if (msg.get("startIndex") instanceof Double) {
Double tempStartIndex = (Double) msg.get("startIndex");
startIndex = tempStartIndex.intValue();
} else {
startIndex = (Integer) msg.get("startIndex");
}
Integer endIndex;
if (msg.get("endIndex") instanceof Double) {
Double tempEndIndex = (Double) msg.get("endIndex");
endIndex = tempEndIndex.intValue();
} else {
endIndex = (Integer) msg.get("endIndex");
}
red5InGW.editCaptionHistory(meetingID, userID, startIndex, endIndex, locale, localeCode, text); red5InGW.editCaptionHistory(meetingID, userID, startIndex, endIndex, locale, localeCode, text);
} }
} }

View File

@ -41,8 +41,22 @@ public class PollingService {
String meetingID = Red5.getConnectionLocal().getScope().getName(); String meetingID = Red5.getConnectionLocal().getScope().getName();
String userId = getBbbSession().getInternalUserID(); String userId = getBbbSession().getInternalUserID();
String pollId = (String) message.get("pollId"); String pollId = (String) message.get("pollId");
Integer questionId = (Integer) message.get("answerId");
Integer answerId = (Integer) message.get("answerId"); Integer questionId;
if (message.get("answerId") instanceof Double) {
Double tempQuestionId = (Double) message.get("answerId");
questionId = tempQuestionId.intValue();
} else {
questionId = (Integer) message.get("answerId");
}
Integer answerId;
if (message.get("answerId") instanceof Double) {
Double tempAnswerId = (Double) message.get("answerId");
answerId = tempAnswerId.intValue();
} else {
answerId = (Integer) message.get("answerId");
}
red5GW.votePoll(meetingID, userId, pollId, questionId, answerId); red5GW.votePoll(meetingID, userId, pollId, questionId, answerId);
} }