tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1791028 - in /tomcat/trunk: java/org/apache/el/lang/ java/org/apache/jasper/compiler/ java/org/apache/tomcat/util/ test/org/apache/el/ test/org/apache/jasper/runtime/ test/webapp/WEB-INF/tags/ test/webapp/bug5nnnn/
Date Tue, 11 Apr 2017 21:16:04 GMT
Author: markt
Date: Tue Apr 11 21:16:04 2017
New Revision: 1791028

URL: http://svn.apache.org/viewvc?rev=1791028&view=rev
Log:
Refactoring in preparation for Java 9. Refactor to avoid using some methods that will be deprecated
in Java 9 onwards.

Modified:
    tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java
    tomcat/trunk/java/org/apache/jasper/compiler/EncodingDetector.java
    tomcat/trunk/java/org/apache/tomcat/util/Diagnostics.java
    tomcat/trunk/test/org/apache/el/TestELInJsp.java
    tomcat/trunk/test/org/apache/jasper/runtime/TestJspContextWrapper.java
    tomcat/trunk/test/webapp/WEB-INF/tags/bug58178b.tag
    tomcat/trunk/test/webapp/bug5nnnn/bug57142.jsp

Modified: tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java Tue Apr 11 21:16:04 2017
@@ -19,6 +19,7 @@ package org.apache.el.lang;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.math.RoundingMode;
 
 import org.apache.el.util.MessageFactory;
 
@@ -53,7 +54,7 @@ public abstract class ELArithmetic {
         @Override
         protected Number divide(Number num0, Number num1) {
             return ((BigDecimal) num0).divide((BigDecimal) num1,
-                    BigDecimal.ROUND_HALF_UP);
+                    RoundingMode.HALF_UP);
         }
 
         @Override
@@ -98,7 +99,7 @@ public abstract class ELArithmetic {
 
         @Override
         protected Number divide(Number num0, Number num1) {
-            return (new BigDecimal((BigInteger) num0)).divide(new BigDecimal((BigInteger)
num1), BigDecimal.ROUND_HALF_UP);
+            return (new BigDecimal((BigInteger) num0)).divide(new BigDecimal((BigInteger)
num1), RoundingMode.HALF_UP);
         }
 
         @Override

Modified: tomcat/trunk/java/org/apache/jasper/compiler/EncodingDetector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/EncodingDetector.java?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/EncodingDetector.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/EncodingDetector.java Tue Apr 11 21:16:04
2017
@@ -35,7 +35,7 @@ class EncodingDetector {
 
     private static final XMLInputFactory XML_INPUT_FACTORY;
     static {
-        XML_INPUT_FACTORY = XMLInputFactory.newFactory();
+        XML_INPUT_FACTORY = XMLInputFactory.newFactory("javax.xml.stream.XMLInputFactory",
null);
     }
 
     private final String encoding;

Modified: tomcat/trunk/java/org/apache/tomcat/util/Diagnostics.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/Diagnostics.java?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/Diagnostics.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/Diagnostics.java Tue Apr 11 21:16:04 2017
@@ -45,6 +45,7 @@ import java.lang.management.MemoryPoolMX
 import java.lang.management.MemoryUsage;
 import java.lang.management.MonitorInfo;
 import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.PlatformLoggingMXBean;
 import java.lang.management.RuntimeMXBean;
 import java.lang.management.ThreadInfo;
 import java.lang.management.ThreadMXBean;
@@ -57,8 +58,6 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.logging.LogManager;
-import java.util.logging.LoggingMXBean;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -95,8 +94,8 @@ public class Diagnostics {
     // XXX Not sure whether the following MBeans should better
     // be retrieved on demand, i.e. whether they can change
     // dynamically in the MBeanServer.
-    private static final LoggingMXBean loggingMXBean =
-        LogManager.getLoggingMXBean();
+    private static final PlatformLoggingMXBean loggingMXBean =
+        ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
     private static final MemoryMXBean memoryMXBean =
         ManagementFactory.getMemoryMXBean();
     private static final List<GarbageCollectorMXBean> garbageCollectorMXBeans =

Modified: tomcat/trunk/test/org/apache/el/TestELInJsp.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELInJsp.java?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELInJsp.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELInJsp.java Tue Apr 11 21:16:04 2017
@@ -17,7 +17,7 @@
 package org.apache.el;
 
 import java.io.File;
-import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Collections;
 
 import javax.servlet.DispatcherType;
@@ -467,7 +467,7 @@ public class TestELInJsp extends TomcatB
         // Could hack something with HttpUtils...
         // No obvious static fields for javax.servlet.jsp
         // Wild card (package) import
-        assertEcho(result, "01-" + BigDecimal.ROUND_UP);
+        assertEcho(result, "01-" + RoundingMode.HALF_UP);
         // Class import
         assertEcho(result, "02-" + Collections.EMPTY_LIST.size());
     }

Modified: tomcat/trunk/test/org/apache/jasper/runtime/TestJspContextWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/runtime/TestJspContextWrapper.java?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/runtime/TestJspContextWrapper.java (original)
+++ tomcat/trunk/test/org/apache/jasper/runtime/TestJspContextWrapper.java Tue Apr 11 21:16:04
2017
@@ -16,7 +16,7 @@
  */
 package org.apache.jasper.runtime;
 
-import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Collections;
 
 import javax.servlet.DispatcherType;
@@ -62,7 +62,7 @@ public class TestJspContextWrapper exten
         // Could hack something with HttpUtils...
         // No obvious status fields for javax.servlet.jsp
         // Wild card (package) import
-        Assert.assertTrue(result, result.contains("01-" + BigDecimal.ROUND_UP));
+        Assert.assertTrue(result, result.contains("01-" + RoundingMode.HALF_UP));
         // Class import
         Assert.assertTrue(result, result.contains("02-" + Collections.EMPTY_LIST.size()));
     }

Modified: tomcat/trunk/test/webapp/WEB-INF/tags/bug58178b.tag
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/WEB-INF/tags/bug58178b.tag?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/WEB-INF/tags/bug58178b.tag (original)
+++ tomcat/trunk/test/webapp/WEB-INF/tags/bug58178b.tag Tue Apr 11 21:16:04 2017
@@ -16,5 +16,5 @@
 --%>
 <%@tag import="java.math.*, java.util.Collections" %>
 <p>00-${DispatcherType.ASYNC}</p>
-<p>01-${BigDecimal.ROUND_UP}</p>
+<p>01-${RoundingMode.HALF_UP}</p>
 <p>02-${Collections.EMPTY_LIST.stream().count()}</p>
\ No newline at end of file

Modified: tomcat/trunk/test/webapp/bug5nnnn/bug57142.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug5nnnn/bug57142.jsp?rev=1791028&r1=1791027&r2=1791028&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/bug5nnnn/bug57142.jsp (original)
+++ tomcat/trunk/test/webapp/bug5nnnn/bug57142.jsp Tue Apr 11 21:16:04 2017
@@ -18,7 +18,7 @@
 <html>
   <body>
     <p>00-${DispatcherType.ASYNC}</p>
-    <p>01-${BigDecimal.ROUND_UP}</p>
+    <p>01-${RoundingMode.HALF_UP}</p>
     <p>02-${Collections.EMPTY_LIST.stream().count()}</p>
   </body>
 </html>
\ No newline at end of file



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


Mime
View raw message