This is an automated email from the ASF dual-hosted git repository.
snoopdave pushed a commit to branch roller-5.2.x
in repository https://gitbox.apache.org/repos/asf/roller.git
The following commit(s) were added to refs/heads/roller-5.2.x by this push:
new 07b7858 [ROL-2135] parse math answer to string.
07b7858 is described below
commit 07b78589c668126702a86ef8edfac23bbea7a4ae
Author: [email protected] <[email protected]>
AuthorDate: Sun Apr 7 17:36:05 2019 -0400
[ROL-2135] parse math answer to string.
---
.../rendering/plugins/comments/MathCommentAuthenticator.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
b/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
index 33a2d5d..8f37859 100644
---
a/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
+++
b/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
@@ -37,7 +37,7 @@ public class MathCommentAuthenticator implements
CommentAuthenticator {
public String getHtml(HttpServletRequest request) {
- String answer = "";
+ int answer = 0;
HttpSession session = request.getSession(true);
if (session.getAttribute("mathAnswer") == null) {
@@ -51,10 +51,12 @@ public class MathCommentAuthenticator implements
CommentAuthenticator {
session.setAttribute("mathAnswer", sum);
} else {
// preserve user's answer
- answer = request.getParameter("answer");
- answer = (answer == null) ? "" : answer;
+ String answerString = request.getParameter("answer");
+ try {
+ answer = Integer.parseInt(answerString);
+ } catch (Throwable intentionallyIgnored) {}
}
-
+
// pull existing values out of session
Integer value1o =
(Integer)request.getSession().getAttribute("mathValue1");
Integer value2o =
(Integer)request.getSession().getAttribute("mathValue2");