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 a51f20fdfc Code clean-up - formatting. No functional change.
a51f20fdfc is described below
commit a51f20fdfc19a6d838fd58c78aa9e19fcfee64e9
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jun 13 12:51:57 2024 +0100
Code clean-up - formatting. No functional change.
---
.../catalina/webresources/AbstractArchiveResourceSet.java | 13 ++++++-------
.../webresources/AbstractSingleArchiveResourceSet.java | 2 +-
java/org/apache/catalina/webresources/Cache.java | 14 +++++++-------
java/org/apache/catalina/webresources/CachedResource.java | 4 ++--
.../apache/catalina/webresources/JarWarResourceSet.java | 10 +++++-----
5 files changed, 21 insertions(+), 22 deletions(-)
diff --git
a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
index ec1ddd15cd..d5551522f5 100644
--- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
@@ -37,7 +37,7 @@ public abstract class AbstractArchiveResourceSet extends
AbstractResourceSet {
private URL baseUrl;
private String baseUrlString;
private JarFile archive = null;
- protected Map<String, JarEntry> archiveEntries = null;
+ protected Map<String,JarEntry> archiveEntries = null;
protected final Object archiveLock = new Object();
private long archiveUseCount = 0;
private JarContents jarContents;
@@ -163,7 +163,7 @@ public abstract class AbstractArchiveResourceSet extends
AbstractResourceSet {
*
* @return The archives entries mapped to their names or null if {@link
#getArchiveEntry(String)} should be used.
*/
- protected abstract Map<String, JarEntry> getArchiveEntries(boolean single);
+ protected abstract Map<String,JarEntry> getArchiveEntries(boolean single);
/**
@@ -205,10 +205,9 @@ public abstract class AbstractArchiveResourceSet extends
AbstractResourceSet {
* If jarContents reports that this resource definitely does not
contain the path, we can end this method and
* move on to the next jar.
*/
- if (jarContents != null &&
- !jarContents.mightContainResource(getInternalPath().isEmpty()
? path : getInternalPath() + path,
- webAppMount)) {
- return new EmptyResource(root, path);
+ if (jarContents != null && !jarContents
+ .mightContainResource(getInternalPath().isEmpty() ? path :
getInternalPath() + path, webAppMount)) {
+ return new EmptyResource(root, path);
}
/*
@@ -245,7 +244,7 @@ public abstract class AbstractArchiveResourceSet extends
AbstractResourceSet {
// Calls JarFile.getJarEntry() which is multi-release aware
jarEntry = getArchiveEntry(pathInJar);
} else {
- Map<String, JarEntry> jarEntries = getArchiveEntries(true);
+ Map<String,JarEntry> jarEntries = getArchiveEntries(true);
if (!(pathInJar.charAt(pathInJar.length() - 1) == '/')) {
if (jarEntries == null) {
jarEntry = getArchiveEntry(pathInJar + '/');
diff --git
a/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
b/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
index f847d91ce1..a28f10e3e0 100644
---
a/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
+++
b/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
@@ -61,7 +61,7 @@ public abstract class AbstractSingleArchiveResourceSet
extends AbstractArchiveRe
@Override
- protected Map<String, JarEntry> getArchiveEntries(boolean single) {
+ protected Map<String,JarEntry> getArchiveEntries(boolean single) {
synchronized (archiveLock) {
if (archiveEntries == null && !single) {
JarFile jarFile = null;
diff --git a/java/org/apache/catalina/webresources/Cache.java
b/java/org/apache/catalina/webresources/Cache.java
index 467a43bf2e..03e933d37c 100644
--- a/java/org/apache/catalina/webresources/Cache.java
+++ b/java/org/apache/catalina/webresources/Cache.java
@@ -52,7 +52,7 @@ public class Cache {
private LongAdder lookupCount = new LongAdder();
private LongAdder hitCount = new LongAdder();
- private final ConcurrentMap<String, CachedResource> resourceCache = new
ConcurrentHashMap<>();
+ private final ConcurrentMap<String,CachedResource> resourceCache = new
ConcurrentHashMap<>();
public Cache(StandardRoot root) {
this.root = root;
@@ -83,8 +83,8 @@ public class Cache {
if (cacheEntry == null) {
// Local copy to ensure consistency
int objectMaxSizeBytes = getObjectMaxSizeBytes();
- CachedResource newCacheEntry = new CachedResource(this, root,
path, getTtl(), objectMaxSizeBytes,
- useClassLoaderResources);
+ CachedResource newCacheEntry =
+ new CachedResource(this, root, path, getTtl(),
objectMaxSizeBytes, useClassLoaderResources);
// Concurrent callers will end up with the same CachedResource
// instance
@@ -161,8 +161,8 @@ public class Cache {
if (cacheEntry == null) {
// Local copy to ensure consistency
int objectMaxSizeBytes = getObjectMaxSizeBytes();
- CachedResource newCacheEntry = new CachedResource(this, root,
path, getTtl(), objectMaxSizeBytes,
- useClassLoaderResources);
+ CachedResource newCacheEntry =
+ new CachedResource(this, root, path, getTtl(),
objectMaxSizeBytes, useClassLoaderResources);
// Concurrent callers will end up with the same CachedResource
// instance
@@ -207,8 +207,8 @@ public class Cache {
// Create an ordered set of all cached resources with the least
recently
// used first. This is a background process so we can afford to take
the
// time to order the elements first
- TreeSet<CachedResource> orderedResources = new TreeSet<>(
- Comparator.comparingLong(CachedResource::getNextCheck));
+ TreeSet<CachedResource> orderedResources =
+ new
TreeSet<>(Comparator.comparingLong(CachedResource::getNextCheck));
orderedResources.addAll(resourceCache.values());
Iterator<CachedResource> iter = orderedResources.iterator();
diff --git a/java/org/apache/catalina/webresources/CachedResource.java
b/java/org/apache/catalina/webresources/CachedResource.java
index 7be8776097..bd217eb083 100644
--- a/java/org/apache/catalina/webresources/CachedResource.java
+++ b/java/org/apache/catalina/webresources/CachedResource.java
@@ -339,8 +339,8 @@ public class CachedResource implements WebResource {
return null;
}
try {
- CachedResourceURLStreamHandler handler = new
CachedResourceURLStreamHandler(resourceURL, root, webAppPath,
- usesClassLoaderResources);
+ CachedResourceURLStreamHandler handler =
+ new CachedResourceURLStreamHandler(resourceURL, root,
webAppPath, usesClassLoaderResources);
@SuppressWarnings("deprecation")
URL result = new URL(null, resourceURL.toExternalForm(), handler);
handler.setCacheURL(result);
diff --git a/java/org/apache/catalina/webresources/JarWarResourceSet.java
b/java/org/apache/catalina/webresources/JarWarResourceSet.java
index 0ed30d8e05..edd4dce4f4 100644
--- a/java/org/apache/catalina/webresources/JarWarResourceSet.java
+++ b/java/org/apache/catalina/webresources/JarWarResourceSet.java
@@ -85,7 +85,7 @@ public class JarWarResourceSet extends
AbstractArchiveResourceSet {
* JarWar can't optimise for a single resource so the Map is always
returned.
*/
@Override
- protected Map<String, JarEntry> getArchiveEntries(boolean single) {
+ protected Map<String,JarEntry> getArchiveEntries(boolean single) {
synchronized (archiveLock) {
if (archiveEntries == null) {
JarFile warFile = null;
@@ -155,10 +155,10 @@ public class JarWarResourceSet extends
AbstractArchiveResourceSet {
int targetVersion = Runtime.version().feature();
- Map<String, VersionedJarEntry> versionedEntries = new HashMap<>();
- Iterator<Entry<String, JarEntry>> iter =
archiveEntries.entrySet().iterator();
+ Map<String,VersionedJarEntry> versionedEntries = new HashMap<>();
+ Iterator<Entry<String,JarEntry>> iter =
archiveEntries.entrySet().iterator();
while (iter.hasNext()) {
- Entry<String, JarEntry> entry = iter.next();
+ Entry<String,JarEntry> entry = iter.next();
String name = entry.getKey();
if (name.startsWith("META-INF/versions/")) {
// Remove the multi-release version
@@ -192,7 +192,7 @@ public class JarWarResourceSet extends
AbstractArchiveResourceSet {
}
}
- for (Entry<String, VersionedJarEntry> versionedJarEntry :
versionedEntries.entrySet()) {
+ for (Entry<String,VersionedJarEntry> versionedJarEntry :
versionedEntries.entrySet()) {
archiveEntries.put(versionedJarEntry.getKey(),
versionedJarEntry.getValue().getJarEntry());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]