tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1811199 - in /tomcat/trunk/java/org/apache/jasper: ./ compiler/ runtime/
Date Thu, 05 Oct 2017 12:50:14 GMT
Author: markt
Date: Thu Oct  5 12:50:14 2017
New Revision: 1811199

URL: http://svn.apache.org/viewvc?rev=1811199&view=rev
Log:
Fix some more deprecation warnings when building with Java 9.
Use of Class.newInstance() in o.a.jasper

Modified:
    tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
    tomcat/trunk/java/org/apache/jasper/compiler/ELInterpreterFactory.java
    tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
    tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
    tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
    tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java

Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Thu Oct  5 12:50:14 2017
@@ -242,13 +242,13 @@ public class JspCompilationContext {
     protected Compiler createCompiler(String className) {
         Compiler compiler = null;
         try {
-            compiler = (Compiler) Class.forName(className).newInstance();
-        } catch (InstantiationException | IllegalAccessException e) {
-            log.warn(Localizer.getMessage("jsp.error.compiler"), e);
+            compiler = (Compiler) Class.forName(className).getDeclaredConstructor().newInstance();
         } catch (NoClassDefFoundError | ClassNotFoundException e) {
             if (log.isDebugEnabled()) {
                 log.debug(Localizer.getMessage("jsp.error.compiler"), e);
             }
+        } catch (ReflectiveOperationException e) {
+            log.warn(Localizer.getMessage("jsp.error.compiler"), e);
         }
         return compiler;
     }

Modified: tomcat/trunk/java/org/apache/jasper/compiler/ELInterpreterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ELInterpreterFactory.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ELInterpreterFactory.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ELInterpreterFactory.java Thu Oct  5 12:50:14
2017
@@ -85,7 +85,7 @@ public class ELInterpreterFactory {
     private static ELInterpreter createInstance(ServletContext context,
             String className) throws Exception {
         return (ELInterpreter) context.getClassLoader().loadClass(
-                    className).newInstance();
+                    className).getDeclaredConstructor().newInstance();
     }
 
 

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java Thu Oct  5 12:50:14
2017
@@ -593,7 +593,7 @@ class TagFileProcessor {
                     // Dependent list. The only reliable dependency information
                     // can only be obtained from the tag instance.
                     try {
-                        Object tagIns = tagClazz.newInstance();
+                        Object tagIns = tagClazz.getDeclaredConstructor().newInstance();
                         if (tagIns instanceof JspSourceDependent) {
                             for (Entry<String, Long> entry : ((JspSourceDependent)
                                     tagIns).getDependants().entrySet()) {

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Thu Oct  5 12:50:14
2017
@@ -290,7 +290,7 @@ class TagLibraryInfoImpl extends TagLibr
         if (teiClassName != null && !teiClassName.isEmpty()) {
             try {
                 Class<?> teiClass = ctxt.getClassLoader().loadClass(teiClassName);
-                tei = (TagExtraInfo) teiClass.newInstance();
+                tei = (TagExtraInfo) teiClass.getDeclaredConstructor().newInstance();
             } catch (Exception e) {
                 err.jspError(e, "jsp.error.teiclass.instantiation", teiClassName);
             }
@@ -346,7 +346,8 @@ class TagLibraryInfoImpl extends TagLibr
 
         try {
             Class<?> tlvClass = ctxt.getClassLoader().loadClass(validatorClass);
-            TagLibraryValidator tlv = (TagLibraryValidator) tlvClass.newInstance();
+            TagLibraryValidator tlv =
+                    (TagLibraryValidator) tlvClass.getDeclaredConstructor().newInstance();
             tlv.setInitParameters(initParams);
             return tlv;
         } catch (Exception e) {

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java Thu Oct  5 12:50:14
2017
@@ -123,7 +123,7 @@ public class TagPluginManager {
                 String tagClass = entry.getKey();
                 String pluginName = entry.getValue();
                 Class<?> pluginClass = ctxt.getClassLoader().loadClass(pluginName);
-                TagPlugin plugin = (TagPlugin) pluginClass.newInstance();
+                TagPlugin plugin = (TagPlugin) pluginClass.getDeclaredConstructor().newInstance();
                 tagPlugins.put(tagClass, plugin);
             } catch (Exception e) {
                 err.jspError(e);

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java Thu Oct  5 12:50:14
2017
@@ -784,7 +784,7 @@ public class JspRuntimeLibrary {
     {
         try {
             PropertyEditor pe =
-                (PropertyEditor)propertyEditorClass.newInstance();
+                (PropertyEditor)propertyEditorClass.getDeclaredConstructor().newInstance();
             pe.setAsText(attrValue);
             return pe.getValue();
         } catch (Exception ex) {

Modified: tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java?rev=1811199&r1=1811198&r2=1811199&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java Thu Oct  5 12:50:14 2017
@@ -47,7 +47,7 @@ public class TagHandlerPool {
         if (tpClassName != null) {
             try {
                 Class<?> c = Class.forName(tpClassName);
-                result = (TagHandlerPool) c.newInstance();
+                result = (TagHandlerPool) c.getDeclaredConstructor().newInstance();
             } catch (Exception e) {
                 e.printStackTrace();
                 result = null;
@@ -112,7 +112,7 @@ public class TagHandlerPool {
                 return (Tag) instanceManager.newInstance(
                         handlerClass.getName(), handlerClass.getClassLoader());
             } else {
-                Tag instance = handlerClass.newInstance();
+                Tag instance = handlerClass.getDeclaredConstructor().newInstance();
                 instanceManager.newInstance(instance);
                 return instance;
             }



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


Mime
View raw message