tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1037887 - in /tomcat/trunk: java/org/apache/catalina/manager/JspHelper.java java/org/apache/catalina/manager/StatusTransformer.java webapps/docs/changelog.xml
Date Mon, 22 Nov 2010 20:59:20 GMT
Author: kkolinko
Date: Mon Nov 22 20:59:20 2010
New Revision: 1037887

URL: http://svn.apache.org/viewvc?rev=1037887&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50316
Fix display of negative values

Modified:
    tomcat/trunk/java/org/apache/catalina/manager/JspHelper.java
    tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/manager/JspHelper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/JspHelper.java?rev=1037887&r1=1037886&r2=1037887&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/JspHelper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/JspHelper.java Mon Nov 22 20:59:20 2010
@@ -135,6 +135,10 @@ public class JspHelper {
 
     public static String secondsToTimeString(long in_seconds) {
         StringBuilder buff = new StringBuilder(9);
+        if (in_seconds < 0) {
+            buff.append('-');
+            in_seconds = -in_seconds;
+        }
         long rest = in_seconds;
         long hour = rest / 3600;
         rest = rest % 3600;

Modified: tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java?rev=1037887&r1=1037886&r2=1037887&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java Mon Nov 22 20:59:20
2010
@@ -871,10 +871,20 @@ public class StatusTransformer {
         }
 
         if (mb) {
+            StringBuilder buff = new StringBuilder();
+            if (bytes < 0) {
+                buff.append('-');
+                bytes = -bytes;
+            }
             long mbytes = bytes / (1024 * 1024);
             long rest = 
                 ((bytes - (mbytes * (1024 * 1024))) * 100) / (1024 * 1024);
-            return (mbytes + "." + ((rest < 10) ? "0" : "") + rest + " MB");
+            buff.append(mbytes).append('.');
+            if (rest < 10) {
+                buff.append('0');
+            }
+            buff.append(rest).append(" MB");
+            return buff.toString();
         } else {
             return ((bytes / 1024) + " KB");
         }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1037887&r1=1037886&r2=1037887&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Nov 22 20:59:20 2010
@@ -298,6 +298,10 @@
       <fix>
         CVE-2010-4172: Multiple XSS in Manager application. (markt/kkolinko)
       </fix>
+      <fix>
+        <bug>50316</bug>: Fix display of negative values in Manager application.
+        (kkolinko)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message