myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject svn commit: r1811678 - /myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
Date Tue, 10 Oct 2017 11:53:42 GMT
Author: tandraschko
Date: Tue Oct 10 11:53:42 2017
New Revision: 1811678

URL: http://svn.apache.org/viewvc?rev=1811678&view=rev
Log:
MYFACES-4122 Auto scroll doesn't work anymore for some environment

Modified:
    myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java

Modified: myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java?rev=1811678&r1=1811677&r2=1811678&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
(original)
+++ myfaces/core/branches/2.1.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
Tue Oct 10 11:53:42 2017
@@ -458,8 +458,8 @@ public final class HtmlJavaScriptUtils
                     .getRequestParameterMap().get(AUTO_SCROLL_PARAM);
             if (scrolling != null && scrolling.length() > 0)
             {
-                int x = 0;
-                int y = 0;
+                double x = 0;
+                double y = 0;
                 int comma = scrolling.indexOf(',');
                 if (comma == -1)
                 {
@@ -470,8 +470,8 @@ public final class HtmlJavaScriptUtils
                 {
                     try
                     {
-                        //we convert to int against XSS vulnerability
-                        x = Integer.parseInt(scrolling.substring(0, comma));
+                        //we convert to double against XSS vulnerability
+                        x = Double.parseDouble(scrolling.substring(0, comma));
                     }
                     catch (NumberFormatException e)
                     {
@@ -492,8 +492,8 @@ public final class HtmlJavaScriptUtils
                         y = 0; //ignore false numbers
                     }
                 }
-                script.append("window.scrollTo(").append(x).append(",")
-                        .append(y).append(");\n");
+                script.append("window.scrollTo(").append(String.valueOf(x)).append(",")
+                        .append(String.valueOf(y)).append(");\n");
             }
         }
 



Mime
View raw message