Fix deprecated code use
diff --git a/tck/src/main/java/com/sun/ts/tests/el/api/jakarta_el/elcontext/ELClientIT.java b/tck/src/main/java/com/sun/ts/tests/el/api/jakarta_el/elcontext/ELClientIT.java index bebf048..d6cc9d8 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/api/jakarta_el/elcontext/ELClientIT.java +++ b/tck/src/main/java/com/sun/ts/tests/el/api/jakarta_el/elcontext/ELClientIT.java
@@ -95,9 +95,8 @@ ELManager elm = new ELManager(); ELContext elc = elm.getELContext(); - String disName = "english"; - Locale en = new Locale(disName); - elc.setLocale(en); + String disName = Locale.ENGLISH.getDisplayName(); + elc.setLocale(Locale.ENGLISH); String result = elc.getLocale().getDisplayName(); if (!result.equalsIgnoreCase(disName)) {
diff --git a/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VRContext.java b/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VRContext.java index 0ce1be1..e067e1d 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VRContext.java +++ b/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VRContext.java
@@ -35,6 +35,7 @@ import jakarta.el.VariableMapper; import java.lang.System.Logger; +import java.lang.reflect.InvocationTargetException; public class VRContext extends ELContext { @@ -82,13 +83,21 @@ try { clazz = Class.forName(classname); - instance = clazz.newInstance(); + instance = clazz.getConstructor().newInstance(); } catch (ClassNotFoundException cnfe) { logger.log(Logger.Level.ERROR, "ClassNotFoundException: " + cnfe.getMessage()); } catch (InstantiationException ie) { logger.log(Logger.Level.ERROR, "InstantiationException: " + ie.getMessage()); } catch (IllegalAccessException iae) { logger.log(Logger.Level.ERROR, "IllegalAccessException: " + iae.getMessage()); + } catch (IllegalArgumentException e) { + logger.log(Logger.Level.ERROR, "IllegalArgumentException: " + e.getMessage()); + } catch (InvocationTargetException e) { + logger.log(Logger.Level.ERROR, "InvocationTargetException: " + e.getMessage()); + } catch (NoSuchMethodException e) { + logger.log(Logger.Level.ERROR, "NoSuchMethodException: " + e.getMessage()); + } catch (SecurityException e) { + logger.log(Logger.Level.ERROR, "SecurityException: " + e.getMessage()); } return instance; }
diff --git a/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VarMapperELContext.java b/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VarMapperELContext.java index 3df09f0..c93f64f 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VarMapperELContext.java +++ b/tck/src/main/java/com/sun/ts/tests/el/common/elcontext/VarMapperELContext.java
@@ -32,6 +32,7 @@ import jakarta.el.VariableMapper; import java.lang.System.Logger; +import java.lang.reflect.InvocationTargetException; /** * This ELContext provides a VariableELResolver to enable the setting and * resolution of variables as well as a VariableMapper implementation. The path @@ -85,13 +86,21 @@ try { clazz = Class.forName(classname); - instance = clazz.newInstance(); + instance = clazz.getConstructor().newInstance(); } catch (ClassNotFoundException cnfe) { logger.log(Logger.Level.ERROR, "ClassNotFoundException: " + cnfe.getMessage()); } catch (InstantiationException ie) { logger.log(Logger.Level.ERROR, "InstantiationException: " + ie.getMessage()); } catch (IllegalAccessException iae) { logger.log(Logger.Level.ERROR, "IllegalAccessException: " + iae.getMessage()); + } catch (IllegalArgumentException e) { + logger.log(Logger.Level.ERROR, "IllegalArgumentException: " + e.getMessage()); + } catch (InvocationTargetException e) { + logger.log(Logger.Level.ERROR, "InvocationTargetException: " + e.getMessage()); + } catch (NoSuchMethodException e) { + logger.log(Logger.Level.ERROR, "NoSuchMethodException: " + e.getMessage()); + } catch (SecurityException e) { + logger.log(Logger.Level.ERROR, "SecurityException: " + e.getMessage()); } return instance; }
diff --git a/tck/src/main/java/com/sun/ts/tests/el/common/util/ELTestUtil.java b/tck/src/main/java/com/sun/ts/tests/el/common/util/ELTestUtil.java index bc3c64f..bf3a032 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/common/util/ELTestUtil.java +++ b/tck/src/main/java/com/sun/ts/tests/el/common/util/ELTestUtil.java
@@ -90,7 +90,7 @@ Class<?>[] argTypes, Object[] params) throws Exception { try { - checkForNPE(clazz.newInstance(), methName, argTypes, params); + checkForNPE(clazz.getConstructor().newInstance(), methName, argTypes, params); } catch (Exception e) { throw new Exception(FAIL + NL + e.toString());
diff --git a/tck/src/main/java/com/sun/ts/tests/el/signaturetest/SigTestDriver.java b/tck/src/main/java/com/sun/ts/tests/el/signaturetest/SigTestDriver.java index b9e2e5c..f38b288 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/signaturetest/SigTestDriver.java +++ b/tck/src/main/java/com/sun/ts/tests/el/signaturetest/SigTestDriver.java
@@ -125,7 +125,7 @@ Class<?> sigTestClass = Class .forName("com.sun.tdk.signaturetest.SignatureTest"); - Object sigTestInstance = sigTestClass.newInstance(); + Object sigTestInstance = sigTestClass.getConstructor().newInstance(); ByteArrayOutputStream output = new ByteArrayOutputStream();
diff --git a/tck/src/main/java/com/sun/ts/tests/el/spec/literal/ELClientIT.java b/tck/src/main/java/com/sun/ts/tests/el/spec/literal/ELClientIT.java index 9495901..665d9e9 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/spec/literal/ELClientIT.java +++ b/tck/src/main/java/com/sun/ts/tests/el/spec/literal/ELClientIT.java
@@ -370,22 +370,22 @@ private List<Float> getFloatList() { List<Float> floatList = new ArrayList<>(); - floatList.add(new Float("8.1F")); - floatList.add(new Float("-70.2F")); - floatList.add(new Float("8.1e4F")); - floatList.add(new Float("8.1E6F")); - floatList.add(new Float("8.1e-9F")); - floatList.add(new Float("8.1E+3F")); - floatList.add(new Float("-.72F")); - floatList.add(new Float(".999F")); - floatList.add(new Float("-.1e1F")); - floatList.add(new Float(".234E22F")); - floatList.add(new Float("-.3444e-2F")); - floatList.add(new Float(".5E+7F")); - floatList.add(new Float("-1e1F")); - floatList.add(new Float("234E2F")); - floatList.add(new Float("-3444e-2F")); - floatList.add(new Float("-3444e+2F")); + floatList.add(Float.valueOf("8.1F")); + floatList.add(Float.valueOf("-70.2F")); + floatList.add(Float.valueOf("8.1e4F")); + floatList.add(Float.valueOf("8.1E6F")); + floatList.add(Float.valueOf("8.1e-9F")); + floatList.add(Float.valueOf("8.1E+3F")); + floatList.add(Float.valueOf("-.72F")); + floatList.add(Float.valueOf(".999F")); + floatList.add(Float.valueOf("-.1e1F")); + floatList.add(Float.valueOf(".234E22F")); + floatList.add(Float.valueOf("-.3444e-2F")); + floatList.add(Float.valueOf(".5E+7F")); + floatList.add(Float.valueOf("-1e1F")); + floatList.add(Float.valueOf("234E2F")); + floatList.add(Float.valueOf("-3444e-2F")); + floatList.add(Float.valueOf("-3444e+2F")); return floatList; }
diff --git a/tck/src/main/java/com/sun/ts/tests/el/spec/relationaloperator/ELClientIT.java b/tck/src/main/java/com/sun/ts/tests/el/spec/relationaloperator/ELClientIT.java index 1aa3372..6af26d3 100644 --- a/tck/src/main/java/com/sun/ts/tests/el/spec/relationaloperator/ELClientIT.java +++ b/tck/src/main/java/com/sun/ts/tests/el/spec/relationaloperator/ELClientIT.java
@@ -88,7 +88,7 @@ logger.log(Logger.Level.TRACE, "first expression to be evaluated is " + expr1); NameValuePair values1[] = NameValuePair - .buildNameValuePair(new Float(-1.0f), new Float(-1.0)); + .buildNameValuePair(Float.valueOf(-1.0f), Float.valueOf((float) -1.0)); Object result1 = ExprEval.evaluateValueExpression(expr1, values1, Boolean.class); @@ -137,7 +137,7 @@ logger.log(Logger.Level.TRACE, "first expression to be evaluated is " + expr1); NameValuePair values1[] = NameValuePair - .buildNameValuePair(new Float(-1.0f), new Float(-1.0)); + .buildNameValuePair(Float.valueOf(-1.0f), Float.valueOf((float)-1.0)); Object result1 = ExprEval.evaluateValueExpression(expr1, values1, Boolean.class);