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

@ -26,7 +26,7 @@ import org.bigbluebutton.red5.pubsub.MessagePublisher;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import org.slf4j.Logger;
public class CaptionService {
private static Logger log = Red5LoggerFactory.getLogger( CaptionService.class, "bigbluebutton" );
@ -59,15 +59,29 @@ public class CaptionService {
}
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 localeCode = msg.get("localeCode").toString();
String text = msg.get("text").toString();
String meetingID = Red5.getConnectionLocal().getScope().getName();
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);
}
}

View File

@ -41,9 +41,23 @@ public class PollingService {
String meetingID = Red5.getConnectionLocal().getScope().getName();
String userId = getBbbSession().getInternalUserID();
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);
}