This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new bc2bc1c202 Code clean-up - formatting. No functional change.
bc2bc1c202 is described below
commit bc2bc1c20275b696d125b7a97cd98ae8e03e95fc
Author: Mark Thomas <[email protected]>
AuthorDate: Thu May 22 14:34:29 2025 +0100
Code clean-up - formatting. No functional change.
---
.../tomcat/util/descriptor/DigesterFactory.java | 35 ++++++++----------
.../tomcat/util/descriptor/LocalResolver.java | 43 ++++++++--------------
.../tomcat/util/descriptor/XmlErrorHandler.java | 9 ++---
.../tomcat/util/descriptor/XmlIdentifiers.java | 33 ++++++-----------
4 files changed, 44 insertions(+), 76 deletions(-)
diff --git a/java/org/apache/tomcat/util/descriptor/DigesterFactory.java
b/java/org/apache/tomcat/util/descriptor/DigesterFactory.java
index d282b0efa4..62a7eee6f7 100644
--- a/java/org/apache/tomcat/util/descriptor/DigesterFactory.java
+++ b/java/org/apache/tomcat/util/descriptor/DigesterFactory.java
@@ -31,13 +31,11 @@ import org.apache.tomcat.util.res.StringManager;
import org.xml.sax.ext.EntityResolver2;
/**
- * Wrapper class around the Digester that hide Digester's initialization
- * details.
+ * Wrapper class around the Digester that hide Digester's initialization
details.
*/
public class DigesterFactory {
- private static final StringManager sm =
- StringManager.getManager(Constants.PACKAGE_NAME);
+ private static final StringManager sm =
StringManager.getManager(Constants.PACKAGE_NAME);
private static final Class<ServletContext> CLASS_SERVLET_CONTEXT;
private static final Class<?> CLASS_JSP_CONTEXT;
@@ -55,20 +53,18 @@ public class DigesterFactory {
/**
- * Mapping of well-known public IDs used by the Servlet API to the matching
- * local resource.
+ * Mapping of well-known public IDs used by the Servlet API to the
matching local resource.
*/
public static final Map<String,String> SERVLET_API_PUBLIC_IDS;
/**
- * Mapping of well-known system IDs used by the Servlet API to the matching
- * local resource.
+ * Mapping of well-known system IDs used by the Servlet API to the
matching local resource.
*/
public static final Map<String,String> SERVLET_API_SYSTEM_IDS;
static {
- Map<String, String> publicIds = new HashMap<>();
- Map<String, String> systemIds = new HashMap<>();
+ Map<String,String> publicIds = new HashMap<>();
+ Map<String,String> systemIds = new HashMap<>();
// W3C
add(publicIds, XmlIdentifiers.XSD_10_PUBLIC,
locationFor("XMLSchema.dtd"));
@@ -165,7 +161,7 @@ public class DigesterFactory {
SERVLET_API_SYSTEM_IDS = Collections.unmodifiableMap(systemIds);
}
- private static void addSelf(Map<String, String> ids, String id) {
+ private static void addSelf(Map<String,String> ids, String id) {
String location = locationFor(id);
if (location != null) {
ids.put(id, location);
@@ -202,22 +198,21 @@ public class DigesterFactory {
/**
* Create a <code>Digester</code> parser.
- * @param xmlValidation turn on/off xml validation
+ *
+ * @param xmlValidation turn on/off xml validation
* @param xmlNamespaceAware turn on/off namespace validation
- * @param rule an instance of <code>RuleSet</code> used for parsing the
xml.
- * @param blockExternal turn on/off the blocking of external resources
+ * @param rule an instance of <code>RuleSet</code> used for
parsing the xml.
+ * @param blockExternal turn on/off the blocking of external resources
+ *
* @return a new digester
*/
- public static Digester newDigester(boolean xmlValidation,
- boolean xmlNamespaceAware,
- RuleSet rule,
- boolean blockExternal) {
+ public static Digester newDigester(boolean xmlValidation, boolean
xmlNamespaceAware, RuleSet rule,
+ boolean blockExternal) {
Digester digester = new Digester();
digester.setNamespaceAware(xmlNamespaceAware);
digester.setValidating(xmlValidation);
digester.setUseContextClassLoader(true);
- EntityResolver2 resolver = new LocalResolver(SERVLET_API_PUBLIC_IDS,
- SERVLET_API_SYSTEM_IDS, blockExternal);
+ EntityResolver2 resolver = new LocalResolver(SERVLET_API_PUBLIC_IDS,
SERVLET_API_SYSTEM_IDS, blockExternal);
digester.setEntityResolver(resolver);
if (rule != null) {
digester.addRuleSet(rule);
diff --git a/java/org/apache/tomcat/util/descriptor/LocalResolver.java
b/java/org/apache/tomcat/util/descriptor/LocalResolver.java
index dbfd593a8b..6f2d616ea6 100644
--- a/java/org/apache/tomcat/util/descriptor/LocalResolver.java
+++ b/java/org/apache/tomcat/util/descriptor/LocalResolver.java
@@ -34,14 +34,10 @@ import org.xml.sax.ext.EntityResolver2;
*/
public class LocalResolver implements EntityResolver2 {
- private static final StringManager sm =
- StringManager.getManager(Constants.PACKAGE_NAME);
+ private static final StringManager sm =
StringManager.getManager(Constants.PACKAGE_NAME);
- private static final String[] JAVA_EE_NAMESPACES = {
- XmlIdentifiers.JAVAEE_1_4_NS,
- XmlIdentifiers.JAVAEE_5_NS,
- XmlIdentifiers.JAVAEE_7_NS,
- XmlIdentifiers.JAKARTAEE_9_NS};
+ private static final String[] JAVA_EE_NAMESPACES = {
XmlIdentifiers.JAVAEE_1_4_NS, XmlIdentifiers.JAVAEE_5_NS,
+ XmlIdentifiers.JAVAEE_7_NS, XmlIdentifiers.JAKARTAEE_9_NS };
private final Map<String,String> publicIds;
@@ -49,19 +45,14 @@ public class LocalResolver implements EntityResolver2 {
private final boolean blockExternal;
/**
- * Constructor providing mappings of public and system identifiers to local
- * resources. Each map contains a mapping from a well-known identifier to a
- * URL for a local resource path.
+ * Constructor providing mappings of public and system identifiers to
local resources. Each map contains a mapping
+ * from a well-known identifier to a URL for a local resource path.
*
- * @param publicIds mapping of well-known public identifiers to local
- * resources
- * @param systemIds mapping of well-known system identifiers to local
- * resources
- * @param blockExternal are external resources blocked that are not
- * well-known
+ * @param publicIds mapping of well-known public identifiers to local
resources
+ * @param systemIds mapping of well-known system identifiers to local
resources
+ * @param blockExternal are external resources blocked that are not
well-known
*/
- public LocalResolver(Map<String,String> publicIds,
- Map<String,String> systemIds, boolean blockExternal) {
+ public LocalResolver(Map<String,String> publicIds, Map<String,String>
systemIds, boolean blockExternal) {
this.publicIds = publicIds;
this.systemIds = systemIds;
this.blockExternal = blockExternal;
@@ -69,15 +60,14 @@ public class LocalResolver implements EntityResolver2 {
@Override
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
+ public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException {
return resolveEntity(null, publicId, null, systemId);
}
@Override
- public InputSource resolveEntity(String name, String publicId,
- String base, String systemId) throws SAXException, IOException {
+ public InputSource resolveEntity(String name, String publicId, String
base, String systemId)
+ throws SAXException, IOException {
// First try resolving using the publicId
String resolved = publicIds.get(publicId);
@@ -89,8 +79,7 @@ public class LocalResolver implements EntityResolver2 {
// If there is no systemId, can't try anything else
if (systemId == null) {
- throw new
FileNotFoundException(sm.getString("localResolver.unresolvedEntity",
- name, publicId, null, base));
+ throw new
FileNotFoundException(sm.getString("localResolver.unresolvedEntity", name,
publicId, null, base));
}
// Try resolving with the supplied systemId
@@ -149,14 +138,12 @@ public class LocalResolver implements EntityResolver2 {
}
}
- throw new
FileNotFoundException(sm.getString("localResolver.unresolvedEntity",
- name, publicId, systemId, base));
+ throw new
FileNotFoundException(sm.getString("localResolver.unresolvedEntity", name,
publicId, systemId, base));
}
@Override
- public InputSource getExternalSubset(String name, String baseURI)
- throws SAXException, IOException {
+ public InputSource getExternalSubset(String name, String baseURI) throws
SAXException, IOException {
return null;
}
}
diff --git a/java/org/apache/tomcat/util/descriptor/XmlErrorHandler.java
b/java/org/apache/tomcat/util/descriptor/XmlErrorHandler.java
index 631c256f73..9365787041 100644
--- a/java/org/apache/tomcat/util/descriptor/XmlErrorHandler.java
+++ b/java/org/apache/tomcat/util/descriptor/XmlErrorHandler.java
@@ -27,8 +27,7 @@ import org.xml.sax.SAXParseException;
public class XmlErrorHandler implements ErrorHandler {
- private static final StringManager sm =
- StringManager.getManager(Constants.PACKAGE_NAME);
+ private static final StringManager sm =
StringManager.getManager(Constants.PACKAGE_NAME);
private final List<SAXParseException> errors = new ArrayList<>();
@@ -64,12 +63,10 @@ public class XmlErrorHandler implements ErrorHandler {
public void logFindings(Log log, String source) {
for (SAXParseException e : getWarnings()) {
- log.warn(sm.getString(
- "xmlErrorHandler.warning", e.getMessage(), source));
+ log.warn(sm.getString("xmlErrorHandler.warning", e.getMessage(),
source));
}
for (SAXParseException e : getErrors()) {
- log.warn(sm.getString(
- "xmlErrorHandler.error", e.getMessage(), source));
+ log.warn(sm.getString("xmlErrorHandler.error", e.getMessage(),
source));
}
}
}
diff --git a/java/org/apache/tomcat/util/descriptor/XmlIdentifiers.java
b/java/org/apache/tomcat/util/descriptor/XmlIdentifiers.java
index eb24bfbb18..7e2b45aa80 100644
--- a/java/org/apache/tomcat/util/descriptor/XmlIdentifiers.java
+++ b/java/org/apache/tomcat/util/descriptor/XmlIdentifiers.java
@@ -17,43 +17,32 @@
package org.apache.tomcat.util.descriptor;
/**
- * Defines constants for well-known Public and System identifiers documented by
- * the Servlet and JSP specifications.
+ * Defines constants for well-known Public and System identifiers documented
by the Servlet and JSP specifications.
*/
public final class XmlIdentifiers {
// from W3C
public static final String XML_2001_XSD = "http://www.w3.org/2001/xml.xsd";
public static final String DATATYPES_PUBLIC = "datatypes";
- public static final String XSD_10_PUBLIC =
- "-//W3C//DTD XMLSCHEMA 200102//EN";
+ public static final String XSD_10_PUBLIC = "-//W3C//DTD XMLSCHEMA
200102//EN";
// from J2EE 1.2
- public static final String WEB_22_PUBLIC =
- "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN";
- public static final String WEB_22_SYSTEM =
- "http://java.sun.com/dtd/web-app_2_2.dtd";
- public static final String TLD_11_PUBLIC =
- "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN";
- public static final String TLD_11_SYSTEM =
- "http://java.sun.com/dtd/web-jsptaglibrary_1_1.dtd";
+ public static final String WEB_22_PUBLIC = "-//Sun Microsystems, Inc.//DTD
Web Application 2.2//EN";
+ public static final String WEB_22_SYSTEM =
"http://java.sun.com/dtd/web-app_2_2.dtd";
+ public static final String TLD_11_PUBLIC = "-//Sun Microsystems, Inc.//DTD
JSP Tag Library 1.1//EN";
+ public static final String TLD_11_SYSTEM =
"http://java.sun.com/dtd/web-jsptaglibrary_1_1.dtd";
// from J2EE 1.3
- public static final String WEB_23_PUBLIC =
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN";
- public static final String WEB_23_SYSTEM =
- "http://java.sun.com/dtd/web-app_2_3.dtd";
- public static final String TLD_12_PUBLIC =
- "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN";
- public static final String TLD_12_SYSTEM =
- "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd";
+ public static final String WEB_23_PUBLIC = "-//Sun Microsystems, Inc.//DTD
Web Application 2.3//EN";
+ public static final String WEB_23_SYSTEM =
"http://java.sun.com/dtd/web-app_2_3.dtd";
+ public static final String TLD_12_PUBLIC = "-//Sun Microsystems, Inc.//DTD
JSP Tag Library 1.2//EN";
+ public static final String TLD_12_SYSTEM =
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd";
// from J2EE 1.4
public static final String JAVAEE_1_4_NS =
"http://java.sun.com/xml/ns/j2ee";
public static final String WEB_24_XSD = JAVAEE_1_4_NS + "/web-app_2_4.xsd";
public static final String TLD_20_XSD = JAVAEE_1_4_NS +
"/web-jsptaglibrary_2_0.xsd";
- public static final String WEBSERVICES_11_XSD =
- "http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd";
+ public static final String WEBSERVICES_11_XSD =
"http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd";
// from JavaEE 5
public static final String JAVAEE_5_NS =
"http://java.sun.com/xml/ns/javaee";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]