diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java index 1ba2190b65f..a5000b026e1 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ import jdk.xml.internal.SecuritySupport; /** * This is the base class for features and properties * - * @LastModified: Mar 2023 + * @LastModified: Nov 2024 */ public abstract class FeaturePropertyBase { @@ -198,7 +198,7 @@ public abstract class FeaturePropertyBase { */ void getSystemProperty(Enum property, String systemProperty) { try { - String value = SecuritySupport.getSystemProperty(systemProperty); + String value = System.getProperty(systemProperty); if (value != null) { values[property.ordinal()] = value; states[property.ordinal()] = State.SYSTEMPROPERTY; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java index c1d910b0616..58971b4d6e2 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,7 +32,7 @@ import jdk.xml.internal.SecuritySupport; * class and modified to be used as a general utility for creating objects * dynamically. * - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public class ObjectFactory { @@ -57,14 +57,8 @@ public class ObjectFactory { * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ - @SuppressWarnings("removal") public static ClassLoader findClassLoader() { - if (System.getSecurityManager()!=null) { - //this will ensure bootclassloader is used - return null; - } - // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = SecuritySupport.getContextClassLoader(); @@ -123,8 +117,7 @@ public class ObjectFactory { public static Object newInstance(String className, boolean doFallback) throws ConfigurationError { - @SuppressWarnings("removal") - ClassLoader cl = System.getSecurityManager()!=null ? null : findClassLoader(); + ClassLoader cl = findClassLoader(); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.getConstructor().newInstance(); @@ -161,24 +154,6 @@ public class ObjectFactory { { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - try{ - if (security != null){ - if (className.startsWith(JAXP_INTERNAL) || - className.startsWith(STAX_INTERNAL)) { - cl = null; - } else { - final int lastDot = className.lastIndexOf("."); - String packageName = className; - if (lastDot != -1) packageName = className.substring(0, lastDot); - security.checkPackageAccess(packageName); - } - } - }catch(SecurityException e){ - throw e; - } - Class providerClass; if (cl == null) { providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader()); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java index 0c20a0ac919..c34f4fa59eb 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,7 +24,7 @@ import java.util.ListResourceBundle; /** * @author Morten Jorgensen - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public class ErrorMessages extends ListResourceBundle { @@ -1028,11 +1028,6 @@ public class ErrorMessages extends ListResourceBundle { "smaller templates." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "When Java security is enabled, " - + "support for deserializing TemplatesImpl is disabled. This can be " - + "overridden by setting the jdk.xml.enableTemplatesImplDeserialization" - + " system property to true."}, - {ErrorMsg.XPATH_GROUP_LIMIT, "JAXP0801001: the compiler encountered an XPath expression containing " + "''{0}'' groups that exceeds the ''{1}'' limit set by ''{2}''."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java index a73fe47191f..12ec243bbc9 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,7 +24,7 @@ import java.util.ListResourceBundle; /** * @author Morten Jorgensen - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public class ErrorMessages_de extends ListResourceBundle { @@ -981,8 +981,6 @@ public class ErrorMessages_de extends ListResourceBundle { "Interner XSLTC-Fehler: Eine Methode im Translet \u00FCberschreitet die Java Virtual Machine-L\u00E4ngeneinschr\u00E4nkung einer Methode von 64 KB. Ursache hierf\u00FCr sind in der Regel sehr gro\u00DFe Vorlagen in einem Stylesheet. Versuchen Sie, das Stylesheet mit kleineren Vorlagen umzustrukturieren." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Wenn die Java-Sicherheit aktiviert ist, wird die Unterst\u00FCtzung f\u00FCr das Deserialisieren von TemplatesImpl deaktiviert. Dieses Verhalten kann durch Setzen der Systemeigenschaft jdk.xml.enableTemplatesImplDeserialization auf \"true\" au\u00DFer Kraft gesetzt werden."}, - {ErrorMsg.XPATH_GROUP_LIMIT, "JAXP0801001: Im Compiler ist ein XPath-Ausdruck mit {0} Gruppen aufgetreten, der den von \"{2}\" festgelegten Grenzwert \"{1}\" \u00FCberschreitet."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java index 111b251d48d..099644221a6 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -979,9 +979,6 @@ public class ErrorMessages_es extends ListResourceBundle { {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG, "Error interno de XSLTC: un m\u00E9todo en el translet excede la limitaci\u00F3n de Java Virtual Machine de longitud de un m\u00E9todo de 64 kilobytes. Normalmente, esto lo causan plantillas en una hoja de estilos demasiado grandes. Pruebe a reestructurar la hoja de estilos para utilizar plantillas m\u00E1s peque\u00F1as." }, - - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Cuando la seguridad de Java est\u00E1 activada, el soporte para anular la serializaci\u00F3n de TemplatesImpl est\u00E1 desactivado. Esto se puede sustituir definiendo la propiedad del sistema jdk.xml.enableTemplatesImplDeserialization en true."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java index 1123464069e..5690aff3192 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_fr extends ListResourceBundle { "Erreur XSLTC interne : une m\u00E9thode dans le translet d\u00E9passe la limite de la JVM concernant la longueur d'une m\u00E9thode de 64 kilo-octets. En g\u00E9n\u00E9ral, ceci est d\u00FB \u00E0 de tr\u00E8s grands mod\u00E8les dans une feuille de style. Essayez de restructurer la feuille de style pour utiliser des mod\u00E8les plus petits." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Lorsque la s\u00E9curit\u00E9 Java est activ\u00E9e, la prise en charge de la d\u00E9s\u00E9rialisation de TemplatesImpl est d\u00E9sactiv\u00E9e. La d\u00E9finition de la propri\u00E9t\u00E9 syst\u00E8me jdk.xml.enableTemplatesImplDeserialization sur True permet de remplacer ce param\u00E8tre."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java index ab05118b8a1..a5c9e0dc348 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_it extends ListResourceBundle { "Errore XSLTC interno: un metodo nel translet supera la limitazione Java Virtual Machine relativa alla lunghezza per un metodo di 64 kilobyte. Ci\u00F2 \u00E8 generalmente causato dalle grandi dimensioni dei modelli in un foglio di stile. Provare a ristrutturare il foglio di stile per utilizzare modelli di dimensioni inferiori." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Quando la sicurezza Java \u00E8 abilitata, il supporto per la deserializzazione TemplatesImpl \u00E8 disabilitato. \u00C8 possibile ignorare questa condizione impostando su true la propriet\u00E0 di sistema jdk.xml.enableTemplatesImplDeserialization."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java index ba170bdfffa..5e03673aef5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,7 +24,7 @@ import java.util.ListResourceBundle; /** * @author Morten Jorgensen - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public class ErrorMessages_ja extends ListResourceBundle { @@ -981,8 +981,6 @@ public class ErrorMessages_ja extends ListResourceBundle { "\u5185\u90E8XSLTC\u30A8\u30E9\u30FC: \u30C8\u30E9\u30F3\u30B9\u30EC\u30C3\u30C8\u5185\u306E\u30E1\u30BD\u30C3\u30C9\u304C\u3001Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u5236\u9650(1\u30E1\u30BD\u30C3\u30C9\u306E\u9577\u3055\u306F\u6700\u592764\u30AD\u30ED\u30D0\u30A4\u30C8)\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\u4E00\u822C\u7684\u306B\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u5185\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u308B\u3053\u3068\u304C\u539F\u56E0\u3068\u3057\u3066\u8003\u3048\u3089\u308C\u307E\u3059\u3002\u5C0F\u3055\u3044\u30B5\u30A4\u30BA\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u4F7F\u7528\u3057\u3066\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092\u518D\u69CB\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002" }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Java\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u304C\u6709\u52B9\u5316\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3001TemplatesImpl\u306E\u30C7\u30B7\u30EA\u30A2\u30E9\u30A4\u30BA\u306E\u30B5\u30DD\u30FC\u30C8\u306F\u7121\u52B9\u5316\u3055\u308C\u307E\u3059\u3002\u3053\u308C\u306F\u3001jdk.xml.enableTemplatesImplDeserialization\u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092true\u306B\u8A2D\u5B9A\u3057\u3066\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3067\u304D\u307E\u3059\u3002"}, - {ErrorMsg.XPATH_GROUP_LIMIT, "JAXP0801001: \u30B3\u30F3\u30D1\u30A4\u30E9\u306F\u3001''{2}''\u3067\u8A2D\u5B9A\u3055\u308C\u305F''{1}''\u5236\u9650\u3092\u8D85\u3048\u308B''{0}''\u30B0\u30EB\u30FC\u30D7\u3092\u542B\u3080XPath\u5F0F\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java index 79785fb75f0..5128d65cadf 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_ko extends ListResourceBundle { "\uB0B4\uBD80 XSLTC \uC624\uB958: translet\uC758 \uBA54\uC18C\uB4DC\uAC00 Java Virtual Machine\uC758 \uBA54\uC18C\uB4DC \uAE38\uC774 \uC81C\uD55C\uC778 64KB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4. \uB300\uAC1C \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uC758 \uD15C\uD50C\uB9AC\uD2B8\uAC00 \uB9E4\uC6B0 \uD06C\uAE30 \uB54C\uBB38\uC5D0 \uBC1C\uC0DD\uD569\uB2C8\uB2E4. \uB354 \uC791\uC740 \uD15C\uD50C\uB9AC\uD2B8\uB97C \uC0AC\uC6A9\uD558\uB3C4\uB85D \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uB97C \uC7AC\uAD6C\uC131\uD574 \uBCF4\uC2ED\uC2DC\uC624." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Java \uBCF4\uC548\uC774 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uB41C \uACBD\uC6B0 TemplatesImpl \uC9C1\uB82C\uD654 \uD574\uC81C\uC5D0 \uB300\uD55C \uC9C0\uC6D0\uC774 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uB429\uB2C8\uB2E4. jdk.xml.enableTemplatesImplDeserialization \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 true\uB85C \uC124\uC815\uD558\uBA74 \uC774\uB97C \uBB34\uD6A8\uD654\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java index 25e16e53925..061348dc2e5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_pt_BR extends ListResourceBundle { "Erro interno de XSLTC: um m\u00E9todo no translet excede a limita\u00E7\u00E3o da M\u00E1quina Virtual Java quanto ao tamanho de um m\u00E9todo de de 64 kilobytes. Em geral, essa situa\u00E7\u00E3o \u00E9 causada por modelos de uma folha de estilos que s\u00E3o muito grandes. Tente reestruturar sua folha de estilos de forma a usar modelos menores." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Quando a seguran\u00E7a do Java est\u00E1 ativada, o suporte para desserializar TemplatesImpl fica desativado. Essa situa\u00E7\u00E3o pode ser corrigida definindo a propriedade do sistema jdk.xml.enableTemplatesImplDeserialization como true."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java index 153e8fa3d15..78a7a6b92e3 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_sv extends ListResourceBundle { "Internt XSLTC-fel: en metod i transleten \u00F6verstiger Java Virtual Machines l\u00E4ngdbegr\u00E4nsning f\u00F6r en metod p\u00E5 64 kilobytes. Det h\u00E4r orsakas vanligen av mycket stora mallar i en formatmall. F\u00F6rs\u00F6k att omstrukturera formatmallen att anv\u00E4nda mindre mallar." }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "N\u00E4r Java-s\u00E4kerheten \u00E4r aktiverad \u00E4r st\u00F6det f\u00F6r avserialisering av TemplatesImpl avaktiverat. Du kan \u00E5sidos\u00E4tta det h\u00E4r genom att st\u00E4lla in systemegenskapen jdk.xml.enableTemplatesImplDeserialization till sant."} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java index 7a96e488a9a..728abc0df37 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,7 +24,7 @@ import java.util.ListResourceBundle; /** * @author Morten Jorgensen - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public class ErrorMessages_zh_CN extends ListResourceBundle { @@ -981,8 +981,6 @@ public class ErrorMessages_zh_CN extends ListResourceBundle { "\u5185\u90E8 XSLTC \u9519\u8BEF: translet \u4E2D\u7684\u65B9\u6CD5\u8D85\u8FC7\u4E86 Java \u865A\u62DF\u673A\u7684\u65B9\u6CD5\u957F\u5EA6\u9650\u5236 64 KB\u3002\u8FD9\u901A\u5E38\u662F\u7531\u4E8E\u6837\u5F0F\u8868\u4E2D\u7684\u6A21\u677F\u975E\u5E38\u5927\u9020\u6210\u7684\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528\u8F83\u5C0F\u7684\u6A21\u677F\u91CD\u65B0\u6784\u5EFA\u6837\u5F0F\u8868\u3002" }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "\u542F\u7528\u4E86 Java \u5B89\u5168\u65F6\uFF0C\u5C06\u7981\u7528\u5BF9\u53CD\u5E8F\u5217\u5316 TemplatesImpl \u7684\u652F\u6301\u3002\u53EF\u4EE5\u901A\u8FC7\u5C06 jdk.xml.enableTemplatesImplDeserialization \u7CFB\u7EDF\u5C5E\u6027\u8BBE\u7F6E\u4E3A true \u6765\u8986\u76D6\u6B64\u8BBE\u7F6E\u3002"}, - {ErrorMsg.XPATH_GROUP_LIMIT, "JAXP0801001\uFF1A\u7F16\u8BD1\u5668\u9047\u5230\u5305\u542B ''{0}'' \u7EC4\u7684 XPath \u8868\u8FBE\u5F0F\uFF0C\u8BE5\u8868\u8FBE\u5F0F\u8D85\u8FC7\u4E86 ''{2}'' \u8BBE\u7F6E\u7684 ''{1}'' \u9650\u5236\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java index 5ab9c32979f..07f1ff4f63d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -980,8 +980,6 @@ public class ErrorMessages_zh_TW extends ListResourceBundle { "\u5167\u90E8 XSLTC \u932F\u8AA4: translet \u4E2D\u7684\u65B9\u6CD5\u8D85\u904E Java \u865B\u64EC\u6A5F\u5668\u5C0D\u65BC\u65B9\u6CD5\u9577\u5EA6 64 KB \u7684\u9650\u5236\u3002\u9019\u901A\u5E38\u662F\u56E0\u70BA\u6A23\u5F0F\u8868\u4E2D\u6709\u975E\u5E38\u5927\u7684\u6A23\u677F\u3002\u8ACB\u5617\u8A66\u91CD\u65B0\u7D44\u7E54\u60A8\u7684\u6A23\u5F0F\u8868\u4EE5\u4F7F\u7528\u8F03\u5C0F\u7684\u6A23\u677F\u3002" }, - {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "\u555F\u7528 Java \u5B89\u5168\u6642\uFF0C\u6703\u505C\u7528\u9084\u539F\u5E8F\u5217\u5316 TemplatesImpl \u7684\u652F\u63F4\u3002\u5C07 jdk.xml.enableTemplatesImplDeserialization \u7CFB\u7D71\u5C6C\u6027\u8A2D\u70BA\u771F\u5373\u53EF\u8986\u5BEB\u6B64\u8A2D\u5B9A\u3002"} - }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java index 937e7bc69ea..c586ad2674c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -33,7 +33,7 @@ import jdk.xml.internal.SecuritySupport; * @author G. Todd Miller * @author Erwin Bolwidt * @author Morten Jorgensen - * @LastModified: Jul 2022 + * @LastModified: Nov 2024 */ public final class ErrorMsg { @@ -169,8 +169,6 @@ public final class ErrorMsg { public static final String OUTLINE_ERR_METHOD_TOO_BIG = "OUTLINE_ERR_METHOD_TOO_BIG"; - public static final String DESERIALIZE_TRANSLET_ERR = "DESERIALIZE_TRANSLET_ERR"; - public static final String XPATH_LIMIT = "XPATH_LIMIT"; public static final String XPATH_GROUP_LIMIT = "XPATH_GROUP_LIMIT"; public static final String XPATH_OPERATOR_LIMIT = "XPATH_OPERATOR_LIMIT"; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java index 469d255ebf3..1d7796f7b69 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -30,7 +30,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.NodeTest; * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public abstract class Type implements Constants { public static final Type Int = new IntType(); @@ -65,10 +65,6 @@ public abstract class Type implements Constants { return Type.ObjectString; } else { - // - @SuppressWarnings("removal") - java.security.AccessControlContext acc = java.security.AccessController.getContext(); - acc.checkPermission(new RuntimePermission("getContextClassLoader")); return new ObjectType(javaClassName); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java index b02aad4f2fd..491000e60ff 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -29,13 +29,13 @@ import jdk.xml.internal.SecuritySupport; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen - * @LastModified: Sep 2017 + * @LastModified: Nov 2024 */ public final class Util { private static char filesep; static { - String temp = SecuritySupport.getSystemProperty("file.separator", "/"); + String temp = System.getProperty("file.separator", "/"); filesep = temp.charAt(0); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java index e7cbb69ecac..ddfd461ea45 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.text.Collator; import java.util.Locale; /** - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public class NodeSortRecordFactory { @@ -149,7 +149,6 @@ public class NodeSortRecordFactory { LinkageError, IllegalAccessException, InstantiationException, - SecurityException, TransletException { try { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java index bb1e89911eb..f167cf78d5a 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,11 +42,9 @@ import java.lang.module.ModuleFinder; import java.lang.module.ModuleReader; import java.lang.module.ModuleReference; import java.lang.reflect.InvocationTargetException; -import java.security.AccessController; import java.security.CodeSigner; import java.security.CodeSource; import java.security.PermissionCollection; -import java.security.PrivilegedAction; import java.security.ProtectionDomain; import java.util.Arrays; import java.util.HashMap; @@ -60,7 +58,6 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.URIResolver; import jdk.xml.internal.JdkConstants; -import jdk.xml.internal.SecuritySupport; /** @@ -68,7 +65,7 @@ import jdk.xml.internal.SecuritySupport; * @author G. Todd Millerj * @author Jochen Cordes * @author Santiago Pericas-Geertsen - * @LastModified: May 2021 + * @LastModified: Nov 2024 */ public final class TemplatesImpl implements Templates, Serializable { static final long serialVersionUID = 673094361519270707L; @@ -262,16 +259,6 @@ public final class TemplatesImpl implements Templates, Serializable { private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null){ - String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); - if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { - ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); - throw new UnsupportedOperationException(err.toString()); - } - } - // We have to read serialized fields first. ObjectInputStream.GetField gf = is.readFields(); _name = (String)gf.get("_name", null); @@ -441,10 +428,7 @@ public final class TemplatesImpl implements Templates, Serializable { Configuration cf = bootLayer.configuration() .resolve(finder, ModuleFinder.of(), Set.of(mn)); - PrivilegedAction pa = () -> bootLayer.defineModules(cf, name -> loader); - @SuppressWarnings("removal") - ModuleLayer layer = AccessController.doPrivileged(pa); - + ModuleLayer layer = bootLayer.defineModules(cf, _ -> loader); Module m = layer.findModule(mn).get(); assert m.getLayer() == layer; @@ -463,14 +447,9 @@ public final class TemplatesImpl implements Templates, Serializable { throw new TransformerConfigurationException(err.toString()); } - @SuppressWarnings("removal") TransletClassLoader loader = - AccessController.doPrivileged(new PrivilegedAction() { - public TransletClassLoader run() { - return new TransletClassLoader(ObjectFactory.findClassLoader(), + new TransletClassLoader(ObjectFactory.findClassLoader(), _tfactory.getExternalExtensionsMap()); - } - }); try { final int classCount = _bytecodes.length; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java index ca52f46daf7..440df5593ea 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -88,7 +88,7 @@ import org.xml.sax.XMLReader; * @author G. Todd Miller * @author Morten Jorgensen * @author Santiago Pericas-Geertsen - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ public class TransformerFactoryImpl extends SAXTransformerFactory implements SourceLoader @@ -265,14 +265,7 @@ public class TransformerFactoryImpl /** * javax.xml.transform.sax.TransformerFactory implementation. */ - @SuppressWarnings("removal") public TransformerFactoryImpl() { - - if (System.getSecurityManager() != null) { - _isSecureMode = true; - _isNotSecureProcessing = false; - } - _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing); _overrideDefaultParser = _xmlFeatures.getFeature( JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER); @@ -1392,7 +1385,7 @@ public class TransformerFactoryImpl // Find the parent directory of the translet. String transletParentDir = transletFile.getParent(); if (transletParentDir == null) - transletParentDir = SecuritySupport.getSystemProperty("user.dir"); + transletParentDir = System.getProperty("user.dir"); File transletParentFile = new File(transletParentDir); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java index a0e0e948f8c..b4dd0ef6b97 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -50,7 +50,7 @@ import org.xml.sax.XMLReader; * * Added Catalog Support for URI resolution * - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ @SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory public final class Util { @@ -207,10 +207,6 @@ public final class Util { "TransformerFactory.newTemplates()"); throw new TransformerConfigurationException(err.toString()); } - catch (SecurityException e) { - ErrorMsg err = new ErrorMsg(ErrorMsg.FILE_ACCESS_ERR, systemId); - throw new TransformerConfigurationException(err.toString()); - } return input; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java index 1fd84e9f639..ac60d679c86 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -83,7 +83,7 @@ import org.w3c.dom.ls.LSSerializer; * @author Andy Clark, IBM * @author Ralf Pfeiffer, IBM * @since PR-DOM-Level-1-19980818. - * @LastModified: Apr 2022 + * @LastModified: Nov 2024 */ public class CoreDocumentImpl extends ParentNode implements Document { @@ -306,7 +306,7 @@ public class CoreDocumentImpl super(null); ownerDocument = this; allowGrammarAccess = grammarAccess; - String systemProp = SecuritySupport.getSystemProperty(Constants.SUN_DOM_PROPERTY_PREFIX+Constants.SUN_DOM_ANCESTOR_CHECCK); + String systemProp = System.getProperty(Constants.SUN_DOM_PROPERTY_PREFIX+Constants.SUN_DOM_ANCESTOR_CHECCK); if (systemProp != null) { if (systemProp.equalsIgnoreCase("false")) { ancestorChecking = false; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java index 455e2b5446f..e6ad6229224 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java @@ -94,7 +94,7 @@ import org.xml.sax.InputSource; * @author K.Venugopal SUN Microsystems * @author Neeraj Bajaj SUN Microsystems * @author Sunitha Reddy SUN Microsystems - * @LastModified: Feb 2024 + * @LastModified: Nov 2024 */ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { @@ -2010,12 +2010,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { // which encoding to use. Leave them for now. private static synchronized URI getUserDir() throws URI.MalformedURIException { // get the user.dir property - String userDir = ""; - try { - userDir = SecuritySupport.getSystemProperty("user.dir"); - } - catch (SecurityException se) { - } + String userDir = System.getProperty("user.dir"); // return empty string if property value is empty string. if (userDir.length() == 0) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/xs/TypeValidator.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/xs/TypeValidator.java index 59504ec0bd4..c3a14f6d82b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/xs/TypeValidator.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/xs/TypeValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -36,12 +36,12 @@ import jdk.xml.internal.SecuritySupport; * @author Neeraj Bajaj, Sun Microsystems, inc. * @author Sandy Gao, IBM * - * @LastModified: Apr 2019 + * @LastModified: Nov 2024 */ public abstract class TypeValidator { private static final boolean USE_CODE_POINT_COUNT_FOR_STRING_LENGTH = - Boolean.parseBoolean(SecuritySupport.getSystemProperty( + Boolean.parseBoolean(System.getProperty( "com.sun.org.apache.xerces.internal.impl.dv.xs.useCodePointCountForStringLength", "false")); // which facets are allowed for this type diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java index 1ee1e5225f2..5d469a0c56c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -39,7 +39,7 @@ import org.xml.sax.SAXNotSupportedException; /** * @author Rajiv Mordani * @author Edwin Goei - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { /** These are DocumentBuilderFactory attributes not DOM attributes */ @@ -220,7 +220,6 @@ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { } } - @SuppressWarnings("removal") public void setFeature(String name, boolean value) throws ParserConfigurationException { if (features == null) { @@ -228,11 +227,6 @@ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { } // If this is the secure processing feature, save it then return. if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { - if (System.getSecurityManager() != null && (!value)) { - throw new ParserConfigurationException( - SAXMessageFormatter.formatMessage(null, - "jaxp-secureprocessing-feature", null)); - } fSecureProcess = value; fSecurityManager.setSecureProcessing(fSecureProcess); features.put(name, value ? Boolean.TRUE : Boolean.FALSE); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java index 5086dab2669..c8b5a7c99b0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -43,7 +43,7 @@ import org.xml.sax.SAXNotSupportedException; * @author Rajiv Mordani * @author Edwin Goei * - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ public class SAXParserFactoryImpl extends SAXParserFactory { @@ -116,7 +116,6 @@ public class SAXParserFactoryImpl extends SAXParserFactory { * Sets the particular feature in the underlying implementation of * org.xml.sax.XMLReader. */ - @SuppressWarnings("removal") public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { @@ -125,11 +124,6 @@ public class SAXParserFactoryImpl extends SAXParserFactory { } // If this is the secure processing feature, save it then return. if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { - if (System.getSecurityManager() != null && (!value)) { - throw new ParserConfigurationException( - SAXMessageFormatter.formatMessage(null, - "jaxp-secureprocessing-feature", null)); - } fSecureProcess = value; fSecurityManager.setSecureProcessing(fSecureProcess); putInFeatures(name, value); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java index fbb758def47..0569961013f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -190,7 +190,7 @@ import jdk.xml.internal.SecuritySupport; * @author Sunitha Reddy * @see javax.xml.datatype.Duration * @since 1.5 - * @LastModified: Aug 2020 + * @LastModified: Nov 2024 */ public class XMLGregorianCalendarImpl @@ -2418,9 +2418,9 @@ public class XMLGregorianCalendarImpl */ private Locale getDefaultLocale() { - String lang = SecuritySupport.getSystemProperty("user.language.format"); - String country = SecuritySupport.getSystemProperty("user.country.format"); - String variant = SecuritySupport.getSystemProperty("user.variant.format"); + String lang = System.getProperty("user.language.format"); + String country = System.getProperty("user.country.format"); + String variant = System.getProperty("user.variant.format"); Locale locale = null; if (lang != null) { if (country != null) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java index f36d2bd14bb..16c07fabbcd 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -70,7 +70,7 @@ import org.xml.sax.SAXParseException; * * @author Kohsuke Kawaguchi * - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ public final class XMLSchemaFactory extends SchemaFactory { @@ -423,7 +423,7 @@ public final class XMLSchemaFactory extends SchemaFactory { } } - @SuppressWarnings({"removal","deprecation"}) + @SuppressWarnings("deprecation") public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { @@ -441,12 +441,6 @@ public final class XMLSchemaFactory extends SchemaFactory { } } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { - if (System.getSecurityManager() != null && (!value)) { - throw new SAXNotSupportedException( - SAXMessageFormatter.formatMessage(null, - "jaxp-secureprocessing-feature", null)); - } - fSecurityManager.setSecureProcessing(value); if (value) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, @@ -464,8 +458,7 @@ public final class XMLSchemaFactory extends SchemaFactory { } else if (name.equals(JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { //in secure mode, let useServicesMechanism be determined by the constructor - if (System.getSecurityManager() != null) - return; + return; } if ((fXmlFeatures != null) && diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java index 179afcaeb31..7644127a60d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -57,7 +57,7 @@ import org.xml.sax.ErrorHandler; *

An implementation of XMLComponentManager for a schema validator.

* * @author Michael Glavassevich, IBM - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettings implements XMLComponentManager { @@ -230,7 +230,6 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin private Locale fLocale = null; /** Constructs a component manager suitable for Xerces' schema validator. */ - @SuppressWarnings("removal") public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContainer) { // setup components fEntityManager = new XMLEntityManager(); @@ -293,11 +292,6 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin fFeatures.put(UNPARSED_ENTITY_CHECKING, Boolean.TRUE); boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING); - if (System.getSecurityManager() != null) { - _isSecureMode = true; - secureProcessing = true; - } - fInitSecurityManager = (XMLSecurityManager) grammarContainer.getProperty(SECURITY_MANAGER); if (fInitSecurityManager != null ) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java index aaddf407288..2d06f6e7e8e 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -35,7 +35,7 @@ import jdk.xml.internal.SecuritySupport; * when bundled as part of the JDK. *

* - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public final class ObjectFactory { @@ -55,13 +55,9 @@ public final class ObjectFactory { /** Returns true if debug has been enabled. */ private static boolean isDebugEnabled() { - try { - String val = SecuritySupport.getSystemProperty("xerces.debug"); - // Allow simply setting the prop to turn on debug - return (val != null && (!"false".equals(val))); - } - catch (SecurityException se) {} - return false; + String val = System.getProperty("xerces.debug"); + // Allow simply setting the prop to turn on debug + return (val != null && (!"false".equals(val))); } // isDebugEnabled() /** Prints a message to standard error if debugging is enabled. */ @@ -75,14 +71,9 @@ public final class ObjectFactory { * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ - @SuppressWarnings("removal") public static ClassLoader findClassLoader() throws ConfigurationError { - if (System.getSecurityManager()!=null) { - //this will ensure bootclassloader is used - return null; - } // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = SecuritySupport.getContextClassLoader(); @@ -138,16 +129,10 @@ public final class ObjectFactory { * Create an instance of a class using the same classloader for the ObjectFactory by default * or bootclassloader when Security Manager is in place */ - @SuppressWarnings("removal") public static Object newInstance(String className, boolean doFallback) throws ConfigurationError { - if (System.getSecurityManager()!=null) { - return newInstance(className, null, doFallback); - } else { - return newInstance(className, - findClassLoader (), doFallback); - } + return newInstance(className, findClassLoader (), doFallback); } /** @@ -191,21 +176,6 @@ public final class ObjectFactory { boolean doFallback) throws ClassNotFoundException, ConfigurationError { - //throw security exception if the calling thread is not allowed to access the package - //restrict the access to package as speicified in java.security policy - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - if (className.startsWith(JAXP_INTERNAL) || - className.startsWith(STAX_INTERNAL)) { - cl = null; - } else { - final int lastDot = className.lastIndexOf("."); - String packageName = className; - if (lastDot != -1) packageName = className.substring(0, lastDot); - security.checkPackageAccess(packageName); - } - } Class providerClass; if (cl == null) { //use the bootstrap ClassLoader. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java index d89072fe277..2b1e1411f5f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -224,7 +224,7 @@ public final class XMLSecurityPropertyManager { */ private void getSystemProperty(Property property, String systemProperty) { try { - String value = SecuritySupport.getSystemProperty(systemProperty); + String value = System.getProperty(systemProperty); if (value != null) { values[property.ordinal()] = value; states[property.ordinal()] = State.SYSTEMPROPERTY; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java index f619b32fac5..17dcac31250 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,7 +42,7 @@ import jdk.xml.internal.SecuritySupport; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. * - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ @Deprecated public abstract class SerializerFactory @@ -74,7 +74,7 @@ public abstract class SerializerFactory factory = new SerializerFactoryImpl( Method.TEXT ); registerSerializerFactory( factory ); - list = SecuritySupport.getSystemProperty( FactoriesProperty ); + list = System.getProperty( FactoriesProperty ); if ( list != null ) { token = new StringTokenizer( list, " ;,:" ); while ( token.hasMoreTokens() ) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java index a88606d5085..a4792795a58 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -48,7 +48,7 @@ import jdk.xml.internal.SecuritySupport; * for each encoding. * * @author Assaf Arkin - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public final class Encodings extends Object @@ -229,41 +229,33 @@ public final class Encodings extends Object if (null == encoding) { - try + // Get the default system character encoding. This may be + // incorrect if they passed in a writer, but right now there + // seems to be no way to get the encoding from a writer. + encoding = System.getProperty("file.encoding", "UTF8"); + + if (null != encoding) { - // Get the default system character encoding. This may be - // incorrect if they passed in a writer, but right now there - // seems to be no way to get the encoding from a writer. - encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8"); + /* + * See if the mime type is equal to UTF8. If you don't + * do that, then convertJava2MimeEncoding will convert + * 8859_1 to "ISO-8859-1", which is not what we want, + * I think, and I don't think I want to alter the tables + * to convert everything to UTF-8. + */ + String jencoding = + (encoding.equalsIgnoreCase("Cp1252") + || encoding.equalsIgnoreCase("ISO8859_1") + || encoding.equalsIgnoreCase("8859_1") + || encoding.equalsIgnoreCase("UTF8")) + ? DEFAULT_MIME_ENCODING + : convertJava2MimeEncoding(encoding); - if (null != encoding) - { - - /* - * See if the mime type is equal to UTF8. If you don't - * do that, then convertJava2MimeEncoding will convert - * 8859_1 to "ISO-8859-1", which is not what we want, - * I think, and I don't think I want to alter the tables - * to convert everything to UTF-8. - */ - String jencoding = - (encoding.equalsIgnoreCase("Cp1252") - || encoding.equalsIgnoreCase("ISO8859_1") - || encoding.equalsIgnoreCase("8859_1") - || encoding.equalsIgnoreCase("UTF8")) - ? DEFAULT_MIME_ENCODING - : convertJava2MimeEncoding(encoding); - - encoding = - (null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING; - } - else - { - encoding = DEFAULT_MIME_ENCODING; - } + encoding = + (null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING; } - catch (SecurityException se) + else { encoding = DEFAULT_MIME_ENCODING; } @@ -329,11 +321,7 @@ public final class Encodings extends Object String urlString = null; InputStream is = null; - try { - urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, ""); - } catch (SecurityException e) { - } - + urlString = System.getProperty(ENCODINGS_PROP, ""); if (urlString != null && urlString.length() > 0) { @SuppressWarnings("deprecation") URL url = new URL(urlString); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java index 9bd16cb86d7..5be3d6a6d76 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -70,7 +70,7 @@ import jdk.xml.internal.SecuritySupport; * @see SerializerFactory * @see Method * @see Serializer - * @LastModified: May 2021 + * @LastModified: Nov 2024 */ public final class OutputPropertiesFactory { @@ -354,7 +354,7 @@ public final class OutputPropertiesFactory for (int i = 0; i < keys.length; i++) { // check System Property. This is kept as is for binary compatibility - String sys = SecuritySupport.getSystemProperty(keys[i]); + String sys = System.getProperty(keys[i]); props.put(keys[i], (sys == null) ? values[i] : sys); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java index fa4e0c90126..ba8c75439e3 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,7 +42,7 @@ import com.sun.org.apache.xml.internal.serializer.utils.URI.MalformedURIExceptio * * @xsl.usage internal * - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public final class SystemIDResolver { @@ -52,8 +52,7 @@ public final class SystemIDResolver * *

The relative URI is a local filesystem path. The path can be * absolute or relative. If it is a relative path, it is resolved relative - * to the system property "user.dir" if it is available; if not (i.e. in an - * Applet perhaps which throws SecurityException) then we just return the + * to the system property "user.dir" if it is available; if not then we just return the * relative path. The space and backslash characters are also replaced to * generate a good absolute URI.

* @@ -71,15 +70,7 @@ public final class SystemIDResolver String absolutePath = localPath; if (!isAbsolutePath(localPath)) { - try - { absolutePath = getAbsolutePathFromRelativePath(localPath); - } - // user.dir not accessible from applet - catch (SecurityException se) - { - return "file:" + localPath; - } } String urlString; @@ -244,14 +235,9 @@ public final class SystemIDResolver if (secondColonIndex > 0) { String localPath = systemId.substring(secondColonIndex-1); - try { - if (!isAbsolutePath(localPath)) - absoluteURI = systemId.substring(0, secondColonIndex-1) + + if (!isAbsolutePath(localPath)) + absoluteURI = systemId.substring(0, secondColonIndex-1) + getAbsolutePathFromRelativePath(localPath); - } - catch (SecurityException se) { - return systemId; - } } } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/ObjectPool.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/ObjectPool.java index c6897b0fc0d..9b1fa9c25d5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/ObjectPool.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/ObjectPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.List; /** * Pool of object of a given type to pick from to help memory usage * @xsl.usage internal - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public class ObjectPool implements java.io.Serializable { @@ -138,7 +138,7 @@ public class ObjectPool implements java.io.Serializable { return objectType.getConstructor().newInstance(); } - catch (InstantiationException | IllegalAccessException | SecurityException | + catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex){} // Throw unchecked exception for error in pool configuration. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/SystemIDResolver.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/SystemIDResolver.java index caf2a4b1ba7..8b1cbfe8279 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/SystemIDResolver.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/SystemIDResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -35,7 +35,7 @@ import com.sun.org.apache.xml.internal.utils.URI.MalformedURIException; * see code comments for details on how resolution is performed.

* @xsl.usage internal * - * @LastModified: Sept 2021 + * @LastModified: Nov 2024 */ public class SystemIDResolver { @@ -45,8 +45,7 @@ public class SystemIDResolver * *

The relative URI is a local filesystem path. The path can be * absolute or relative. If it is a relative path, it is resolved relative - * to the system property "user.dir" if it is available; if not (i.e. in an - * Applet perhaps which throws SecurityException) then we just return the + * to the system property "user.dir" if it is available; if not then we just return the * relative path. The space and backslash characters are also replaced to * generate a good absolute URI.

* @@ -64,15 +63,7 @@ public class SystemIDResolver String absolutePath = localPath; if (!isAbsolutePath(localPath)) { - try - { absolutePath = getAbsolutePathFromRelativePath(localPath); - } - // user.dir not accessible from applet - catch (SecurityException se) - { - return "file:" + localPath; - } } String urlString; @@ -237,14 +228,9 @@ public class SystemIDResolver if (secondColonIndex > 0) { String localPath = systemId.substring(secondColonIndex-1); - try { - if (!isAbsolutePath(localPath)) - absoluteURI = systemId.substring(0, secondColonIndex-1) + - getAbsolutePathFromRelativePath(localPath); - } - catch (SecurityException se) { - return systemId; - } + if (!isAbsolutePath(localPath)) + absoluteURI = systemId.substring(0, secondColonIndex-1) + + getAbsolutePathFromRelativePath(localPath); } } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java index d1ab24859fa..91a6597a603 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -37,7 +37,7 @@ import org.xml.sax.XMLReader; * Creates XMLReader objects and caches them for re-use. * This class follows the singleton pattern. * - * @LastModified: July 2023 + * @LastModified: Nov 2024 */ public class XMLReaderManager { @@ -118,7 +118,7 @@ public class XMLReaderManager { ReaderWrapper rw = m_readers.get(); boolean threadHasReader = (rw != null); reader = threadHasReader ? rw.reader : null; - String factory = SecuritySupport.getSystemProperty(property); + String factory = System.getProperty(property); if (threadHasReader && m_inUse.get(reader) != Boolean.TRUE && (rw.overrideDefaultParser == m_overrideDefaultParser) && ( factory == null || reader.getClass().getName().equals(factory))) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java index def8cec86ce..90fabdc0f58 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/res/XResourceBundle.java @@ -21,12 +21,7 @@ package com.sun.org.apache.xml.internal.utils.res; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * The default (english) resource bundle. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java index 532d1cf6299..326c40f4355 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. */ /** * Licensed to the Apache Software Foundation (ASF) under one @@ -31,7 +31,7 @@ import javax.xml.transform.TransformerException; /** * The function table for XPath. * - * @LastModified: Oct 2017 + * @LastModified: Nov 2024 */ public class FunctionTable { @@ -348,7 +348,7 @@ public class FunctionTable Class c = m_functions_customer[which-NUM_BUILT_IN_FUNCS]; return (Function) c.getConstructor().newInstance(); } - }catch (InstantiationException | IllegalAccessException | SecurityException | + }catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex){ throw new TransformerException(ex.getMessage()); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java index 819faa61b9c..0beccb5132b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,7 +32,7 @@ import jdk.xml.internal.SecuritySupport; /** * Execute the SystemProperty() function. * @xsl.usage advanced - * @LastModified: Sep 2017 + * @LastModified: Nov 2024 */ public class FuncSystemProperty extends FunctionOneArg { @@ -96,44 +96,21 @@ public class FuncSystemProperty extends FunctionOneArg new Object[]{ namespace, fullName }); //"Don't currently do anything with namespace "+namespace+" in property: "+fullName); - try + result = System.getProperty(propName); + if (null == result) { - result = SecuritySupport.getSystemProperty(propName); - - if (null == result) - { - - // result = System.getenv(propName); - return XString.EMPTYSTRING; - } - } - catch (SecurityException se) - { - warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, - new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName); - + // result = System.getenv(propName); return XString.EMPTYSTRING; } } } else { - try + result = System.getProperty(fullName); + + if (null == result) { - result = SecuritySupport.getSystemProperty(fullName); - - if (null == result) - { - - // result = System.getenv(fullName); - return XString.EMPTYSTRING; - } - } - catch (SecurityException se) - { - warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, - new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName); - + // result = System.getenv(fullName); return XString.EMPTYSTRING; } } @@ -163,7 +140,6 @@ public class FuncSystemProperty extends FunctionOneArg { try { - // Use SecuritySupport class to provide privileged access to property file try (InputStream is = SecuritySupport.getResourceAsStream(XSLT_PROPERTIES)) { target.load(is); // and load up the property bag from this } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java index aa1e37ea6b3..7c5269f9d12 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -37,7 +37,7 @@ import jdk.xml.internal.XMLSecurityManager; * * @author Ramesh Mandava * - * @LastModified: Jan 2022 + * @LastModified: Nov 2024 */ public class XPathFactoryImpl extends XPathFactory { @@ -78,12 +78,7 @@ public class XPathFactoryImpl extends XPathFactory { /** * javax.xml.xpath.XPathFactory implementation. */ - @SuppressWarnings("removal") public XPathFactoryImpl() { - if (System.getSecurityManager() != null) { - _isSecureMode = true; - _isNotSecureProcessing = false; - } _featureManager = new JdkXmlFeatures(!_isNotSecureProcessing); _xmlSecMgr = new XMLSecurityManager(true); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java index eaa02c98798..433a0f85389 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Jul 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources extends ListResourceBundle { @@ -337,7 +337,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -882,9 +881,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "Do not currently do anything with namespace {0} in property: {1}"}, - { WG_SECURITY_EXCEPTION, - "SecurityException when trying to access XSL system property: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "Old syntax: quo(...) is no longer defined in XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java index eed36ae9d7a..272dca058d3 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Jul 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_de extends ListResourceBundle { @@ -337,7 +337,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -880,9 +879,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "Derzeit keine Aktion mit Namespace {0} in Eigenschaft {1} ausf\u00FChren"}, - { WG_SECURITY_EXCEPTION, - "SecurityException beim Versuch, auf XSL-Systemeigenschaft {0} zuzugreifen"}, - { WG_QUO_NO_LONGER_DEFINED, "Alte Syntax: quo(...) nicht mehr definiert in XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java index faa87ab77c7..859983ca6dd 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_es extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "No realice ninguna acci\u00F3n con el espacio de nombres {0} en la propiedad: {1}"}, - { WG_SECURITY_EXCEPTION, - "Excepci\u00F3n de seguridad al intentar acceder a la propiedad del sistema XSL: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "Sintaxis anterior: quo(...) ya no se define en XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java index 4f17799a935..d9ddcf8212a 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_fr extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "Espace de noms {0} inexploitable dans la propri\u00E9t\u00E9 : {1}"}, - { WG_SECURITY_EXCEPTION, - "Exception SecurityException g\u00E9n\u00E9r\u00E9e lors de la tentative d''acc\u00E8s \u00E0 la propri\u00E9t\u00E9 syst\u00E8me XSL : {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "L'ancienne syntaxe quo(...) n'est plus d\u00E9finie dans XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java index a1bb1f43fbb..ad730f9894f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_it extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "Non effettuare alcuna operazione sullo spazio di nomi {0} nella propriet\u00E0: {1}"}, - { WG_SECURITY_EXCEPTION, - "SecurityException nel tentativo di accedere alla propriet\u00E0 di sistema XSL {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "Sintassi obsoleta: quo(...) non \u00E8 pi\u00F9 definito nell'XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java index 7347a22f8e9..1b707cd7820 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Jul 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_ja extends ListResourceBundle { @@ -337,7 +337,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -880,9 +879,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "\u30D7\u30ED\u30D1\u30C6\u30A3{1}\u5185\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9{0}\u3067\u306F\u73FE\u5728\u4F55\u3082\u5B9F\u884C\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044"}, - { WG_SECURITY_EXCEPTION, - "XSL\u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3{0}\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u3088\u3046\u3068\u3057\u305F\u3068\u304D\u306BSecurityException\u304C\u767A\u751F\u3057\u307E\u3057\u305F"}, - { WG_QUO_NO_LONGER_DEFINED, "\u53E4\u3044\u69CB\u6587: quo(...)\u306FXPath\u3067\u306F\u73FE\u5728\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java index 2b2f4f811ff..01e0f4062ed 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_ko extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "\uC18D\uC131\uC758 {0} \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uB300\uD574 \uD604\uC7AC \uC5B4\uB5A4 \uC791\uC5C5\uB3C4 \uC218\uD589\uD558\uC9C0 \uC54A\uC544\uC57C \uD568: {1}"}, - { WG_SECURITY_EXCEPTION, - "XSL \uC2DC\uC2A4\uD15C \uC18D\uC131\uC5D0 \uC561\uC138\uC2A4\uD558\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 SecurityException \uBC1C\uC0DD: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "\uC774\uC804 \uAD6C\uBB38: quo(...)\uAC00 XPath\uC5D0 \uB354 \uC774\uC0C1 \uC815\uC758\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java index 4a8226142fa..ee9e50cf644 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_pt_BR extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "Nenhuma a\u00E7\u00E3o a ser tomada com o namespace {0} na propriedade: {1}"}, - { WG_SECURITY_EXCEPTION, - "SecurityException ao tentar acessar a propriedade de sistema XSL: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "Sintaxe antiga: quo(...) n\u00E3o est\u00E1 mais definido no XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java index 61585bda1c3..c0acf167b9d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_sv extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "G\u00F6r f\u00F6r n\u00E4rvarande inte n\u00E5gonting med namnrymden {0} i egenskap: {1}"}, - { WG_SECURITY_EXCEPTION, - "SecurityException vid f\u00F6rs\u00F6k att f\u00E5 \u00E5tkomst till XSL-systemegenskap: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "Gammal syntax: quo(...) definieras inte l\u00E4ngre i XPath."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java index 511fb6ad768..dd9e507a8f0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Jul 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_zh_CN extends ListResourceBundle { @@ -337,7 +337,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -880,9 +879,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "\u76EE\u524D\u4E0D\u8981\u4F7F\u7528\u5C5E\u6027{1}\u4E2D\u7684\u540D\u79F0\u7A7A\u95F4{0}\u6267\u884C\u4EFB\u4F55\u64CD\u4F5C"}, - { WG_SECURITY_EXCEPTION, - "\u5C1D\u8BD5\u8BBF\u95EE XSL \u7CFB\u7EDF\u5C5E\u6027\u65F6\u51FA\u73B0 SecurityException: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "\u65E7\u8BED\u6CD5: XPath \u4E2D\u4E0D\u518D\u5B9A\u4E49 quo(...)\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java index d962d6b0c8c..edfb20a0920 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ import java.util.ListResourceBundle; * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: May 2022 + * @LastModified: Nov 2024 */ public class XPATHErrorResources_zh_TW extends ListResourceBundle { @@ -326,7 +326,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; - public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = @@ -839,9 +838,6 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = { WG_DONT_DO_ANYTHING_WITH_NS, "\u76EE\u524D\u4E0D\u6703\u8655\u7406\u5C6C\u6027\u4E2D\u7684\u547D\u540D\u7A7A\u9593 {0}: {1}"}, - { WG_SECURITY_EXCEPTION, - "\u5617\u8A66\u5B58\u53D6 XSL \u7CFB\u7D71\u5C6C\u6027\u6642\u767C\u751F SecurityException: {0}"}, - { WG_QUO_NO_LONGER_DEFINED, "\u820A\u8A9E\u6CD5: XPath \u4E2D\u4E0D\u518D\u5B9A\u7FA9 quo(...)\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java index 3f1fb40f73f..2befe055739 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -404,12 +404,7 @@ public class XMLEntityStorage { // which encoding to use. Leave them for now. private static synchronized String getUserDir() { // get the user.dir property - String userDir = ""; - try { - userDir = SecuritySupport.getSystemProperty("user.dir"); - } - catch (SecurityException se) { - } + String userDir = System.getProperty("user.dir"); // return empty string if property value is empty string. if (userDir.length() == 0) diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java index 47f85159c1c..75b930d0537 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,7 +240,7 @@ public class WriterUtility { private CharsetEncoder getDefaultEncoder(){ try{ - String encoding = SecuritySupport.getSystemProperty("file.encoding"); + String encoding = System.getProperty("file.encoding"); if(encoding != null){ return Charset.forName(encoding).newEncoder(); } diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java index 3dbe4b24536..05c974b54bf 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -339,7 +339,7 @@ public final class XMLStreamWriterImpl extends AbstractMap fEncoder = Charset.forName(encoding).newEncoder(); } } else { - encoding = SecuritySupport.getSystemProperty("file.encoding"); + encoding = System.getProperty("file.encoding"); if (encoding != null && encoding.equalsIgnoreCase("utf-8")) { fWriter = new UTF8OutputStreamWriter(os); } else { diff --git a/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java b/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java index 1c498148933..4376bbe9fdf 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java +++ b/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java @@ -597,7 +597,7 @@ public class CatalogFeatures { */ private boolean getSystemProperty(Feature cf, String sysPropertyName) { if (cf.hasSystemProperty()) { - String value = SecuritySupport.getSystemProperty(sysPropertyName); + String value = System.getProperty(sysPropertyName); if (value != null && !value.isEmpty()) { setProperty(cf, State.SYSTEMPROPERTY, value); return true; diff --git a/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java b/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java index 9074ea2e44f..27ad30dec02 100644 --- a/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.xml.datatype; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; @@ -51,16 +49,9 @@ class FactoryFinder { // Define system property "jaxp.debug" to get output static { - // Use try/catch block to support applets, which throws - // SecurityException out of this code. - try { - String val = SecuritySupport.getSystemProperty("jaxp.debug"); - // Allow simply setting the prop to turn on debug - debug = val != null && !"false".equals(val); - } - catch (SecurityException se) { - debug = false; - } + String val = System.getProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); } private static void dPrint(Supplier msgGen) { @@ -153,21 +144,12 @@ class FactoryFinder { * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. */ - @SuppressWarnings("removal") static T newInstance(Class type, String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) throws DatatypeConfigurationException { assert type != null; - // make sure we have access to restricted packages - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - cl = null; - useBSClsLoader = true; - } - } - try { Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); if (!type.isAssignableFrom(providerClass)) { @@ -209,15 +191,10 @@ class FactoryFinder { dPrint(()->"find factoryId =" + factoryId); // Use the system property first - try { - String systemProp = SecuritySupport.getSystemProperty(factoryId); - if (systemProp != null) { - dPrint(()->"found system property, value=" + systemProp); - return newInstance(type, systemProp, null, true); - } - } - catch (SecurityException se) { - if (debug) se.printStackTrace(); + String systemProp = System.getProperty(factoryId); + if (systemProp != null) { + dPrint(()->"found system property, value=" + systemProp); + return newInstance(type, systemProp, null, true); } // try to read from the configuration file @@ -247,22 +224,17 @@ class FactoryFinder { * * @return instance of provider class if found or null */ - @SuppressWarnings("removal") private static T findServiceProvider(final Class type) throws DatatypeConfigurationException { try { - return AccessController.doPrivileged(new PrivilegedAction() { - public T run() { - final ServiceLoader serviceLoader = ServiceLoader.load(type); - final Iterator iterator = serviceLoader.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return null; - } - } - }); + final ServiceLoader serviceLoader = ServiceLoader.load(type); + final Iterator iterator = serviceLoader.iterator(); + if (iterator.hasNext()) { + return iterator.next(); + } else { + return null; + } } catch(ServiceConfigurationError e) { final DatatypeConfigurationException error = new DatatypeConfigurationException( diff --git a/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java b/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java index b11f030d4f6..3fa1c220f6c 100644 --- a/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.xml.parsers; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; @@ -50,16 +48,9 @@ class FactoryFinder { // Define system property "jaxp.debug" to get output static { - // Use try/catch block to support applets, which throws - // SecurityException out of this code. - try { - String val = SecuritySupport.getSystemProperty("jaxp.debug"); - // Allow simply setting the prop to turn on debug - debug = val != null && !"false".equals(val); - } - catch (SecurityException se) { - debug = false; - } + String val = System.getProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); } private static void dPrint(Supplier msgGen) { @@ -153,19 +144,11 @@ class FactoryFinder { * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. */ - @SuppressWarnings("removal") static T newInstance(Class type, String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) throws FactoryConfigurationError { assert type != null; - // make sure we have access to restricted packages - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - cl = null; - useBSClsLoader = true; - } - } try { Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); @@ -207,15 +190,10 @@ class FactoryFinder { dPrint(()->"find factoryId =" + factoryId); // Use the system property first - try { - String systemProp = SecuritySupport.getSystemProperty(factoryId); - if (systemProp != null) { - dPrint(()->"found system property, value=" + systemProp); - return newInstance(type, systemProp, null, true); - } - } - catch (SecurityException se) { - if (debug) se.printStackTrace(); + String systemProp = System.getProperty(factoryId); + if (systemProp != null) { + dPrint(()->"found system property, value=" + systemProp); + return newInstance(type, systemProp, null, true); } // try to read from the configuration file @@ -245,20 +223,15 @@ class FactoryFinder { * * @return instance of provider class if found or null */ - @SuppressWarnings("removal") private static T findServiceProvider(final Class type) { try { - return AccessController.doPrivileged(new PrivilegedAction() { - public T run() { - final ServiceLoader serviceLoader = ServiceLoader.load(type); - final Iterator iterator = serviceLoader.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return null; - } - } - }); + final ServiceLoader serviceLoader = ServiceLoader.load(type); + final Iterator iterator = serviceLoader.iterator(); + if (iterator.hasNext()) { + return iterator.next(); + } else { + return null; + } } catch(ServiceConfigurationError e) { // It is not possible to wrap an error directly in // FactoryConfigurationError - so we need to wrap the diff --git a/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java b/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java index d3375a3db62..c389e9edd94 100644 --- a/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.xml.stream; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; @@ -52,16 +50,9 @@ class FactoryFinder { // Define system property "jaxp.debug" to get output static { - // Use try/catch block to support applets, which throws - // SecurityException out of this code. - try { - String val = SecuritySupport.getSystemProperty("jaxp.debug"); - // Allow simply setting the prop to turn on debug - debug = val != null && !"false".equals(val); - } - catch (SecurityException se) { - debug = false; - } + String val = System.getProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); } private static void dPrint(Supplier msgGen) { @@ -154,21 +145,12 @@ class FactoryFinder { * @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter * is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. */ - @SuppressWarnings("removal") static T newInstance(Class type, String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader) throws FactoryConfigurationError { assert type != null; - // make sure we have access to restricted packages - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - cl = null; - useBSClsLoader = true; - } - } - try { Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); if (!type.isAssignableFrom(providerClass)) { @@ -235,22 +217,15 @@ class FactoryFinder { dPrint(()->"find factoryId =" + factoryId); // Use the system property first - try { - - final String systemProp; - if (type.getName().equals(factoryId)) { - systemProp = SecuritySupport.getSystemProperty(factoryId); - } else { - systemProp = System.getProperty(factoryId); - } - if (systemProp != null) { - dPrint(()->"found system property, value=" + systemProp); - return newInstance(type, systemProp, cl, true); - } + final String systemProp; + if (type.getName().equals(factoryId)) { + systemProp = System.getProperty(factoryId); + } else { + systemProp = System.getProperty(factoryId); } - catch (SecurityException se) { - throw new FactoryConfigurationError( - "Failed to read factoryId '" + factoryId + "'", se); + if (systemProp != null) { + dPrint(()->"found system property, value=" + systemProp); + return newInstance(type, systemProp, cl, true); } // try to read from the configuration file @@ -287,27 +262,21 @@ class FactoryFinder { * * @return instance of provider class if found or null */ - @SuppressWarnings("removal") private static T findServiceProvider(final Class type, final ClassLoader cl) { try { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public T run() { - final ServiceLoader serviceLoader; - if (cl == null) { - //the current thread's context class loader - serviceLoader = ServiceLoader.load(type); - } else { - serviceLoader = ServiceLoader.load(type, cl); - } - final Iterator iterator = serviceLoader.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return null; - } - } - }); + final ServiceLoader serviceLoader; + if (cl == null) { + //the current thread's context class loader + serviceLoader = ServiceLoader.load(type); + } else { + serviceLoader = ServiceLoader.load(type, cl); + } + final Iterator iterator = serviceLoader.iterator(); + if (iterator.hasNext()) { + return iterator.next(); + } else { + return null; + } } catch(ServiceConfigurationError e) { // It is not possible to wrap an error directly in // FactoryConfigurationError - so we need to wrap the diff --git a/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java b/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java index 3b1944fa8de..ca0731d1878 100644 --- a/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.xml.transform; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; @@ -51,16 +49,9 @@ class FactoryFinder { // Define system property "jaxp.debug" to get output static { - // Use try/catch block to support applets, which throws - // SecurityException out of this code. - try { - String val = SecuritySupport.getSystemProperty("jaxp.debug"); - // Allow simply setting the prop to turn on debug - debug = val != null && !"false".equals(val); - } - catch (SecurityException se) { - debug = false; - } + String val = System.getProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); } private static void dPrint(Supplier msgGen) { @@ -128,10 +119,9 @@ class FactoryFinder { * @param doFallback True if the current ClassLoader should be tried as * a fallback if the class is not found using cl * - * @param overrideDefaultParser True to allow overriding the system-default + * @param doFallback True to allow overriding the system-default * parser. */ - @SuppressWarnings("removal") static T newInstance(Class type, String className, ClassLoader cl, boolean doFallback) throws TransformerFactoryConfigurationError @@ -139,13 +129,6 @@ class FactoryFinder { assert type != null; boolean useBSClsLoader = false; - // make sure we have access to restricted packages - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - cl = null; - useBSClsLoader = true; - } - } try { Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); @@ -191,15 +174,10 @@ class FactoryFinder { dPrint(()->"find factoryId =" + factoryId); // Use the system property first - try { - String systemProp = SecuritySupport.getSystemProperty(factoryId); - if (systemProp != null) { - dPrint(()->"found system property, value=" + systemProp); - return newInstance(type, systemProp, null, true); - } - } - catch (SecurityException se) { - if (debug) se.printStackTrace(); + String systemProp = System.getProperty(factoryId); + if (systemProp != null) { + dPrint(()->"found system property, value=" + systemProp); + return newInstance(type, systemProp, null, true); } // try to read from the configuration file @@ -229,22 +207,17 @@ class FactoryFinder { * * @return instance of provider class if found or null */ - @SuppressWarnings("removal") private static T findServiceProvider(final Class type) throws TransformerFactoryConfigurationError { try { - return AccessController.doPrivileged(new PrivilegedAction() { - public T run() { - final ServiceLoader serviceLoader = ServiceLoader.load(type); - final Iterator iterator = serviceLoader.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return null; - } - } - }); + final ServiceLoader serviceLoader = ServiceLoader.load(type); + final Iterator iterator = serviceLoader.iterator(); + if (iterator.hasNext()) { + return iterator.next(); + } else { + return null; + } } catch(ServiceConfigurationError e) { // It is not possible to wrap an error directly in // FactoryConfigurationError - so we need to wrap the diff --git a/src/java.xml/share/classes/javax/xml/transform/TransformerException.java b/src/java.xml/share/classes/javax/xml/transform/TransformerException.java index 241c1ae77b5..2e01dc00361 100644 --- a/src/java.xml/share/classes/javax/xml/transform/TransformerException.java +++ b/src/java.xml/share/classes/javax/xml/transform/TransformerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,13 +27,10 @@ package javax.xml.transform; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; -import java.security.AccessControlContext; -import java.security.AccessController; import java.security.CodeSigner; import java.security.CodeSource; import java.security.PermissionCollection; import java.security.Permissions; -import java.security.PrivilegedAction; import java.security.ProtectionDomain; import java.util.Objects; @@ -230,19 +227,11 @@ public class TransformerException extends Exception { * @return A string with location info, or null * if there is no location information. */ - @SuppressWarnings("removal") public String getLocationAsString() { if (locator == null) { return null; } - - if (System.getSecurityManager() == null) { - return getLocationString(); - } else { - return AccessController.doPrivileged((PrivilegedAction) () -> - getLocationString(), - new AccessControlContext(new ProtectionDomain[] {getNonPrivDomain()})); - } + return getLocationString(); } /** diff --git a/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java b/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java index 7140483ae5a..6b8cf9441e1 100644 --- a/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,6 @@ package javax.xml.validation; import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory; import java.lang.reflect.InvocationTargetException; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; import java.util.function.Supplier; @@ -49,12 +46,7 @@ class SchemaFactoryFinder { private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; static { - // Use try/catch block to support applets - try { - debug = SecuritySupport.getSystemProperty("jaxp.debug") != null; - } catch (Exception unused) { - debug = false; - } + debug = System.getProperty("jaxp.debug") != null; } /** @@ -152,7 +144,7 @@ class SchemaFactoryFinder { // system property look up try { debugPrintln(()->"Looking up system property '"+propertyName+"'" ); - String r = SecuritySupport.getSystemProperty(propertyName); + String r = System.getProperty(propertyName); if(r!=null) { debugPrintln(()->"The value is '"+r+"'"); sf = createInstance(r); @@ -201,19 +193,10 @@ class SchemaFactoryFinder { * @param className Name of class to create. * @return Created class or null. */ - @SuppressWarnings("removal") private Class createClass(String className) { Class clazz; - // make sure we have access to restricted packages - boolean internal = false; - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - internal = true; - } - } - try { - if (classLoader != null && !internal) { + if (classLoader != null) { clazz = Class.forName(className, false, classLoader); } else { clazz = Class.forName(className); @@ -258,8 +241,7 @@ class SchemaFactoryFinder { } schemaFactory = (SchemaFactory) clazz.getConstructor().newInstance(); } catch (ClassCastException | IllegalAccessException | IllegalArgumentException | - InstantiationException | InvocationTargetException | NoSuchMethodException | - SecurityException ex) { + InstantiationException | InvocationTargetException | NoSuchMethodException ex) { debugPrintln(()->"could not instantiate " + clazz.getName()); if (debug) { ex.printStackTrace(); @@ -270,18 +252,6 @@ class SchemaFactoryFinder { return schemaFactory; } - // Call isSchemaLanguageSupported with initial context. - @SuppressWarnings("removal") - private boolean isSchemaLanguageSupportedBy(final SchemaFactory factory, - final String schemaLanguage, - AccessControlContext acc) { - return AccessController.doPrivileged(new PrivilegedAction() { - public Boolean run() { - return factory.isSchemaLanguageSupported(schemaLanguage); - } - }, acc); - } - /** * Finds a service provider subclass of SchemaFactory that supports the * given schema language using the ServiceLoader. @@ -291,26 +261,18 @@ class SchemaFactoryFinder { * if none is found. * @throws SchemaFactoryConfigurationError if a configuration error is found. */ - @SuppressWarnings("removal") private SchemaFactory findServiceProvider(final String schemaLanguage) { assert schemaLanguage != null; - // store current context. - final AccessControlContext acc = AccessController.getContext(); try { - return AccessController.doPrivileged(new PrivilegedAction() { - public SchemaFactory run() { - final ServiceLoader loader = - ServiceLoader.load(SERVICE_CLASS); - for (SchemaFactory factory : loader) { - // restore initial context to call - // factory.isSchemaLanguageSupported - if (isSchemaLanguageSupportedBy(factory, schemaLanguage, acc)) { - return factory; - } - } - return null; // no factory found. + final ServiceLoader loader = + ServiceLoader.load(SERVICE_CLASS); + for (SchemaFactory factory : loader) { + // factory.isSchemaLanguageSupported + if (factory.isSchemaLanguageSupported(schemaLanguage)) { + return factory; } - }); + } + return null; // no factory found. } catch (ServiceConfigurationError error) { throw new SchemaFactoryConfigurationError( "Provider for " + SERVICE_CLASS + " cannot be created", error); diff --git a/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java b/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java index c6cdb6d4098..7726adac3fb 100644 --- a/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java +++ b/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,6 @@ package javax.xml.xpath; import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl; import java.lang.reflect.InvocationTargetException; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Properties; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; @@ -48,12 +45,7 @@ class XPathFactoryFinder { /** debug support code. */ private static boolean debug = false; static { - // Use try/catch block to support applets - try { - debug = SecuritySupport.getSystemProperty("jaxp.debug") != null; - } catch (Exception unused) { - debug = false; - } + debug = System.getProperty("jaxp.debug") != null; } /** @@ -157,7 +149,7 @@ class XPathFactoryFinder { // system property look up try { debugPrintln(()->"Looking up system property '"+propertyName+"'" ); - String r = SecuritySupport.getSystemProperty(propertyName); + String r = System.getProperty(propertyName); if(r!=null) { debugPrintln(()->"The value is '"+r+"'"); xpathFactory = createInstance(r); @@ -208,20 +200,12 @@ class XPathFactoryFinder { * @param className Name of class to create. * @return Created class or null. */ - @SuppressWarnings("removal") private Class createClass(String className) { Class clazz; - // make sure we have access to restricted packages - boolean internal = false; - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - internal = true; - } - } // use appropriate ClassLoader try { - if (classLoader != null && !internal) { + if (classLoader != null) { clazz = Class.forName(className, false, classLoader); } else { clazz = Class.forName(className); @@ -264,8 +248,7 @@ class XPathFactoryFinder { try { xPathFactory = (XPathFactory) clazz.getConstructor().newInstance(); } catch (ClassCastException | IllegalAccessException | IllegalArgumentException | - InstantiationException | InvocationTargetException | NoSuchMethodException | - SecurityException ex) { + InstantiationException | InvocationTargetException | NoSuchMethodException ex) { debugPrintln(()->"could not instantiate " + clazz.getName()); if (debug) { ex.printStackTrace(); @@ -276,18 +259,6 @@ class XPathFactoryFinder { return xPathFactory; } - // Call isObjectModelSupportedBy with initial context. - @SuppressWarnings("removal") - private boolean isObjectModelSupportedBy(final XPathFactory factory, - final String objectModel, - AccessControlContext acc) { - return AccessController.doPrivileged(new PrivilegedAction() { - public Boolean run() { - return factory.isObjectModelSupported(objectModel); - } - }, acc); - } - /** * Finds a service provider subclass of XPathFactory that supports the * given object model using the ServiceLoader. @@ -297,28 +268,20 @@ class XPathFactoryFinder { * if none is found. * @throws XPathFactoryConfigurationException if a configuration error is found. */ - @SuppressWarnings("removal") private XPathFactory findServiceProvider(final String objectModel) throws XPathFactoryConfigurationException { assert objectModel != null; - // store current context. - final AccessControlContext acc = AccessController.getContext(); try { - return AccessController.doPrivileged(new PrivilegedAction() { - public XPathFactory run() { - final ServiceLoader loader = - ServiceLoader.load(SERVICE_CLASS); - for (XPathFactory factory : loader) { - // restore initial context to call - // factory.isObjectModelSupportedBy - if (isObjectModelSupportedBy(factory, objectModel, acc)) { - return factory; - } - } - return null; // no factory found. + final ServiceLoader loader = + ServiceLoader.load(SERVICE_CLASS); + for (XPathFactory factory : loader) { + // factory.isObjectModelSupportedBy + if (factory.isObjectModelSupported(objectModel)) { + return factory; } - }); + } + return null; // no factory found. } catch (ServiceConfigurationError error) { throw new XPathFactoryConfigurationException(error); } diff --git a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java index bfb43f47d0e..b3b42588911 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -401,7 +401,7 @@ public class JdkXmlFeatures { */ private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) { try { - String value = SecuritySupport.getSystemProperty(sysPropertyName); + String value = System.getProperty(sysPropertyName); if (value != null && !value.isEmpty()) { setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value)); return true; diff --git a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java index 7ee98622317..47c68173d84 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,8 +51,8 @@ import org.xml.sax.XMLReader; * Constants for use across JAXP processors. */ public class JdkXmlUtils { - public static final boolean IS_WINDOWS = SecuritySupport.getSystemProperty("os.name").contains("Windows"); - public static final String JAVA_HOME = SecuritySupport.getSystemProperty("java.home"); + public static final boolean IS_WINDOWS = System.getProperty("os.name").contains("Windows"); + public static final String JAVA_HOME = System.getProperty("java.home"); private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory"; private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory"; @@ -298,7 +298,7 @@ public class JdkXmlUtils { boolean useCatalog, CatalogFeatures catalogFeatures) { SAXParserFactory saxFactory; XMLReader reader = null; - String spSAXDriver = SecuritySupport.getSystemProperty(SAX_DRIVER); + String spSAXDriver = System.getProperty(SAX_DRIVER); if (spSAXDriver != null) { reader = getXMLReaderWXMLReaderFactory(); } else if (overrideDefaultParser) { @@ -401,12 +401,11 @@ public class JdkXmlUtils { * * @return a DocumentBuilderFactory instance. */ - @SuppressWarnings("removal") public static DocumentBuilderFactory getDOMFactory(boolean overrideDefaultParser) { boolean override = overrideDefaultParser; String spDOMFactory = SecuritySupport.getJAXPSystemProperty(DOM_FACTORY_ID); - if (spDOMFactory != null && System.getSecurityManager() == null) { + if (spDOMFactory != null) { override = true; } DocumentBuilderFactory dbf @@ -428,11 +427,10 @@ public class JdkXmlUtils { * * @return a SAXParserFactory instance. */ - @SuppressWarnings("removal") public static SAXParserFactory getSAXFactory(boolean overrideDefaultParser) { boolean override = overrideDefaultParser; String spSAXFactory = SecuritySupport.getJAXPSystemProperty(SAX_FACTORY_ID); - if (spSAXFactory != null && System.getSecurityManager() == null) { + if (spSAXFactory != null) { override = true; } diff --git a/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java b/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java index 071676703e1..dee62f58950 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java +++ b/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java @@ -32,11 +32,7 @@ import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.nio.file.Paths; -import java.security.AccessController; import java.security.CodeSource; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; @@ -77,56 +73,6 @@ public class SecuritySupport { return msg; } - /** - * Reads a system property with privilege - * - * @param propName the name of the property - * @return the value of the property - */ - @SuppressWarnings("removal") - public static String getSystemProperty(final String propName) { - return - AccessController.doPrivileged( - (PrivilegedAction) () -> System.getProperty(propName)); - } - - /** - * Reads a system property with privilege - * - * @param propName the name of the property - * @return the value of the property - */ - public static String getSystemProperty(final String propName, String defValue) { - String value = getSystemProperty(propName); - if (value == null) { - return defValue; - } - return value; - } - - /** - * Reads a system property with specified type. - * - * @param the type of the property value - * @param type the type of the property value - * @param propName the name of the property - * @param defValue the default value - * @return the value of the property, or the default value if no system - * property is found - */ - public static T getSystemProperty(Class type, String propName, String defValue) { - String value = getSystemProperty(propName); - if (value == null) { - value = defValue; - } - if (Integer.class == type) { - return type.cast(Integer.parseInt(value)); - } else if (Boolean.class == type) { - return type.cast(Boolean.parseBoolean(value)); - } - return type.cast(value); - } - /** * Reads JAXP system property in this order: system property, * $java.home/conf/jaxp.properties if the system property is not specified @@ -159,7 +105,7 @@ public class SecuritySupport { * @return the value of the property */ public static String getJAXPSystemProperty(String propName) { - String value = getSystemProperty(propName); + String value = System.getProperty(propName); if (value == null) { value = readConfig(propName); } @@ -199,21 +145,21 @@ public class SecuritySupport { synchronized (cacheProps) { if (firstTime) { boolean found = loadProperties( - Paths.get(SecuritySupport.getSystemProperty("java.home"), + Paths.get(System.getProperty("java.home"), "conf", "jaxp.properties") .toAbsolutePath().normalize().toString()); // attempts to find stax.properties only if jaxp.properties is not available if (stax && !found) { found = loadProperties( - Paths.get(SecuritySupport.getSystemProperty("java.home"), + Paths.get(System.getProperty("java.home"), "conf", "stax.properties") .toAbsolutePath().normalize().toString() ); } // load the custom configure on top of the default if any - String configFile = SecuritySupport.getSystemProperty(JdkConstants.CONFIG_FILE_PROPNAME); + String configFile = System.getProperty(JdkConstants.CONFIG_FILE_PROPNAME); if (configFile != null) { loadProperties(configFile); } @@ -249,10 +195,8 @@ public class SecuritySupport { * @param f the file to be tested * @return true if it is a directory, false otherwise */ - @SuppressWarnings("removal") public static boolean isDirectory(final File f) { - return (AccessController.doPrivileged((PrivilegedAction) () - -> f.isDirectory())); + return f.isDirectory(); } /** @@ -261,10 +205,8 @@ public class SecuritySupport { * @param f the file to be tested * @return true if the file exists, false otherwise */ - @SuppressWarnings("removal") public static boolean isFileExists(final File f) { - return (AccessController.doPrivileged((PrivilegedAction) () - -> f.exists())); + return f.exists(); } /** @@ -273,10 +215,8 @@ public class SecuritySupport { * @param f the file to be tested * @return true if the input is file, false otherwise */ - @SuppressWarnings("removal") public static boolean isFile(final File f) { - return (AccessController.doPrivileged((PrivilegedAction) () - -> f.isFile())); + return f.isFile(); } /** @@ -285,15 +225,9 @@ public class SecuritySupport { * @return the FileInputStream * @throws FileNotFoundException if the file is not found */ - @SuppressWarnings("removal") public static FileInputStream getFileInputStream(final File file) throws FileNotFoundException { - try { - return AccessController.doPrivileged((PrivilegedExceptionAction) () - -> new FileInputStream(file)); - } catch (PrivilegedActionException e) { - throw (FileNotFoundException) e.getException(); - } + return new FileInputStream(file); } /** @@ -302,15 +236,9 @@ public class SecuritySupport { * @return the InputStream * @throws IOException if an I/O error occurs while creating the input stream */ - @SuppressWarnings("removal") public static InputStream getInputStream(final URLConnection uc) throws IOException { - try { - return AccessController.doPrivileged((PrivilegedExceptionAction) () - -> uc.getInputStream()); - } catch (PrivilegedActionException e) { - throw (IOException) e.getException(); - } + return uc.getInputStream(); } /** @@ -318,10 +246,8 @@ public class SecuritySupport { * @param name the resource name * @return the resource stream */ - @SuppressWarnings("removal") public static InputStream getResourceAsStream(final String name) { - return AccessController.doPrivileged((PrivilegedAction) () -> - SecuritySupport.class.getResourceAsStream("/"+name)); + return SecuritySupport.class.getResourceAsStream("/"+name); } /** @@ -329,10 +255,8 @@ public class SecuritySupport { * @param name the resource name * @return the resource */ - @SuppressWarnings("removal") public static URL getResource(final String name) { - return AccessController.doPrivileged((PrivilegedAction) () -> - SecuritySupport.class.getResource(name)); + return SecuritySupport.class.getResource(name); } /** @@ -350,20 +274,17 @@ public class SecuritySupport { * @param locale the locale for which a resource bundle is desired * @return a resource bundle for the given base name and locale */ - @SuppressWarnings("removal") public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) { - return AccessController.doPrivileged((PrivilegedAction) () -> { + try { + return ResourceBundle.getBundle(bundle, locale); + } catch (MissingResourceException e) { try { - return ResourceBundle.getBundle(bundle, locale); - } catch (MissingResourceException e) { - try { - return ResourceBundle.getBundle(bundle, Locale.US); - } catch (MissingResourceException e2) { - throw new MissingResourceException( - "Could not load any resource bundle by " + bundle, bundle, ""); - } + return ResourceBundle.getBundle(bundle, Locale.US); + } catch (MissingResourceException e2) { + throw new MissingResourceException( + "Could not load any resource bundle by " + bundle, bundle, ""); } - }); + } } /** @@ -371,19 +292,8 @@ public class SecuritySupport { * @param f the specified file * @return true if the file exists, false otherwise */ - @SuppressWarnings("removal") public static boolean doesFileExist(final File f) { - return (AccessController.doPrivileged((PrivilegedAction) () -> f.exists())); - } - - /** - * Checks the LastModified attribute of a file. - * @param f the specified file - * @return the LastModified attribute - */ - @SuppressWarnings("removal") - static long getLastModified(final File f) { - return (AccessController.doPrivileged((PrivilegedAction) () -> f.lastModified())); + return f.exists(); } /** @@ -465,57 +375,35 @@ public class SecuritySupport { return false; } - @SuppressWarnings("removal") public static ClassLoader getContextClassLoader() { - return AccessController.doPrivileged((PrivilegedAction) () -> { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - cl = ClassLoader.getSystemClassLoader(); - return cl; - }); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) + cl = ClassLoader.getSystemClassLoader(); + return cl; } - - @SuppressWarnings("removal") public static ClassLoader getSystemClassLoader() { - return AccessController.doPrivileged((PrivilegedAction) () -> { - ClassLoader cl = null; - try { - cl = ClassLoader.getSystemClassLoader(); - } catch (SecurityException ex) { - } - return cl; - }); + return ClassLoader.getSystemClassLoader(); } - @SuppressWarnings("removal") public static ClassLoader getParentClassLoader(final ClassLoader cl) { - return AccessController.doPrivileged((PrivilegedAction) () -> { - ClassLoader parent = null; - try { - parent = cl.getParent(); - } catch (SecurityException ex) { - } + ClassLoader parent = cl.getParent(); - // eliminate loops in case of the boot - // ClassLoader returning itself as a parent - return (parent == cl) ? null : parent; - }); + // eliminate loops in case of the boot + // ClassLoader returning itself as a parent + return (parent == cl) ? null : parent; } // Used for debugging purposes - @SuppressWarnings("removal") public static String getClassSource(Class cls) { - return AccessController.doPrivileged((PrivilegedAction) () -> { - CodeSource cs = cls.getProtectionDomain().getCodeSource(); - if (cs != null) { - URL loc = cs.getLocation(); - return loc != null ? loc.toString() : "(no location)"; - } else { - return "(no code source)"; - } - }); + CodeSource cs = cls.getProtectionDomain().getCodeSource(); + if (cs != null) { + URL loc = cs.getLocation(); + return loc != null ? loc.toString() : "(no location)"; + } else { + return "(no code source)"; + } } // ---------------- For SAX ---------------------- @@ -523,31 +411,24 @@ public class SecuritySupport { * Returns the current thread's context class loader, or the system class loader * if the context class loader is null. * @return the current thread's context class loader, or the system class loader - * @throws SecurityException */ - @SuppressWarnings("removal") - public static ClassLoader getClassLoader() throws SecurityException{ - return AccessController.doPrivileged((PrivilegedAction)() -> { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) { - cl = ClassLoader.getSystemClassLoader(); - } + public static ClassLoader getClassLoader() { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + cl = ClassLoader.getSystemClassLoader(); + } - return cl; - }); + return cl; } - @SuppressWarnings("removal") public static InputStream getResourceAsStream(final ClassLoader cl, final String name) { - return AccessController.doPrivileged((PrivilegedAction) () -> { - InputStream ris; - if (cl == null) { - ris = SecuritySupport.class.getResourceAsStream(name); - } else { - ris = cl.getResourceAsStream(name); - } - return ris; - }); + InputStream ris; + if (cl == null) { + ris = SecuritySupport.class.getResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; } } diff --git a/src/java.xml/share/classes/jdk/xml/internal/Utils.java b/src/java.xml/share/classes/jdk/xml/internal/Utils.java index e60bc8f060d..f55ab95a58f 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/Utils.java +++ b/src/java.xml/share/classes/jdk/xml/internal/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,14 +41,9 @@ public class Utils { * and processors */ static { - try { - String val = SecuritySupport.getSystemProperty("jaxp.debug"); - // Allow simply setting the prop to turn on debug - debug = val != null && !"false".equals(val); - } - catch (SecurityException se) { - debug = false; - } + String val = System.getProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); } // print out debug information if jaxp.debug is enabled diff --git a/src/java.xml/share/classes/jdk/xml/internal/XMLSecurityManager.java b/src/java.xml/share/classes/jdk/xml/internal/XMLSecurityManager.java index d343b99cf14..cace5492d69 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/XMLSecurityManager.java +++ b/src/java.xml/share/classes/jdk/xml/internal/XMLSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -716,7 +716,7 @@ public final class XMLSecurityManager { if (sysPropertyName == null) return false; try { - String value = SecuritySupport.getSystemProperty(sysPropertyName); + String value = System.getProperty(sysPropertyName); if (value != null && !value.equals("")) { setLimit(limit, State.SYSTEMPROPERTY, value); return true; diff --git a/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java b/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java index 0be2e912246..683d4b383d5 100644 --- a/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java +++ b/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java @@ -46,8 +46,6 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; @@ -143,7 +141,6 @@ public final class DOMImplementationRegistry { * If any specified class does not implement * DOMImplementationSource */ - @SuppressWarnings("removal") public static DOMImplementationRegistry newInstance() throws ClassNotFoundException, @@ -173,15 +170,8 @@ public final class DOMImplementationRegistry { StringTokenizer st = new StringTokenizer(p); while (st.hasMoreTokens()) { String sourceName = st.nextToken(); - // make sure we have access to restricted packages - boolean internal = false; - if (System.getSecurityManager() != null) { - if (sourceName != null && sourceName.startsWith(DEFAULT_PACKAGE)) { - internal = true; - } - } - Class sourceClass = null; - if (classLoader != null && !internal) { + Class sourceClass; + if (classLoader != null) { sourceClass = classLoader.loadClass(sourceName); } else { sourceClass = Class.forName(sourceName); @@ -341,63 +331,32 @@ public final class DOMImplementationRegistry { * * @return The Context Classloader */ - @SuppressWarnings("removal") private static ClassLoader getContextClassLoader() { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public ClassLoader run() { - ClassLoader classLoader = null; - try { - classLoader = - Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { - } - return classLoader; - } - }); + return Thread.currentThread().getContextClassLoader(); } /** - * This method returns the system property indicated by the specified name - * after checking access control privileges. + * This method returns the system property indicated by the specified name. * * @param name the name of the system property * @return the system property */ - @SuppressWarnings("removal") private static String getSystemProperty(final String name) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(name); - } - }); + return System.getProperty(name); } /** - * This method returns an Inputstream for the reading resource - * META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking - * access control privileges. + * This method returns an InputStream for the reading resource + * META_INF/services/org.w3c.dom.DOMImplementationSourceList. * * @param classLoader classLoader * @param name the resource - * @return an Inputstream for the resource specified + * @return an InputStream for the resource specified */ - @SuppressWarnings("removal") private static InputStream getResourceAsStream(final ClassLoader classLoader, final String name) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public InputStream run() { - InputStream ris; - if (classLoader == null) { - ris = - ClassLoader.getSystemResourceAsStream(name); - } else { - ris = classLoader.getResourceAsStream(name); - } - return ris; - } - }); + return (classLoader == null) + ? ClassLoader.getSystemResourceAsStream(name) + : classLoader.getResourceAsStream(name); } } diff --git a/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java b/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java index 03e7f7e8e9f..9abece46e68 100644 --- a/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java +++ b/src/java.xml/share/classes/org/xml/sax/helpers/NewInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,6 @@ class NewInstance { * * Package private so this code is not exposed at the API level. */ - @SuppressWarnings("removal") static T newInstance (Class type, ClassLoader loader, String clsName) throws ClassNotFoundException, IllegalAccessException, InstantiationException @@ -65,15 +64,8 @@ class NewInstance { } // make sure we have access to restricted packages - boolean internal = false; - if (System.getSecurityManager() != null) { - if (className != null && className.startsWith(DEFAULT_PACKAGE)) { - internal = true; - } - } - Class driverClass; - if (classLoader == null || internal) { + if (classLoader == null) { driverClass = Class.forName(className); } else { driverClass = classLoader.loadClass(className); @@ -81,7 +73,7 @@ class NewInstance { try { return type.cast(driverClass.getConstructor().newInstance()); - } catch (NoSuchMethodException | SecurityException | InvocationTargetException ex) { + } catch (NoSuchMethodException | InvocationTargetException ex) { throw new InstantiationException(ex.getMessage()); } } diff --git a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java index 072b81f1671..b67200bcabe 100644 --- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java +++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -90,7 +90,7 @@ public class ParserAdapter implements XMLReader, DocumentHandler { super(); - String driver = SecuritySupport.getSystemProperty("org.xml.sax.parser"); + String driver = System.getProperty("org.xml.sax.parser"); try { setup(ParserFactory.makeParser()); diff --git a/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java b/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java index d4dfb6ca6ce..789237b6acf 100644 --- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java +++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,7 @@ public class ParserFactory { NullPointerException, ClassCastException { - String className = SecuritySupport.getSystemProperty("org.xml.sax.parser"); + String className = System.getProperty("org.xml.sax.parser"); if (className == null) { throw new NullPointerException("No value for sax.parser property"); } else { diff --git a/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java b/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java index a3f3faea8f1..00fd01ab4e7 100644 --- a/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java +++ b/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,6 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Iterator; import java.util.Objects; import java.util.ServiceConfigurationError; @@ -129,7 +127,7 @@ final public class XMLReaderFactory // 1. try the JVM-instance-wide system property try { - className = SecuritySupport.getSystemProperty(property); + className = System.getProperty(property); } catch (RuntimeException e) { /* continue searching */ } @@ -236,21 +234,11 @@ final public class XMLReaderFactory * * @return instance of provider class if found or null */ - @SuppressWarnings("removal") private static T findServiceProvider(final Class type, final ClassLoader loader) throws SAXException { ClassLoader cl = Objects.requireNonNull(loader); try { - return AccessController.doPrivileged((PrivilegedAction) () -> { - final ServiceLoader serviceLoader; - serviceLoader = ServiceLoader.load(type, cl); - final Iterator iterator = serviceLoader.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return null; - } - }); + return ServiceLoader.load(type, cl).findFirst().orElse(null); } catch(ServiceConfigurationError e) { final RuntimeException x = new RuntimeException( "Provider for " + type + " cannot be created", e);