Skip to content

Commit b2fe176

Browse files
committed
upgrade tomcat/jackson-core for vulns
1 parent 483702c commit b2fe176

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
java-version: '17'
8585
- name: Smoke Test
8686
run: |
87-
git clone --branch=devops https://github.com/vmware/singleton.git devops
87+
git clone --branch=devops https://github.com/vmware/singleton.git jhua/devops
8888
cd $GITHUB_WORKSPACE/g11n-ws && ./gradlew build -x test
8989
cp $GITHUB_WORKSPACE/devops/deploy/i18n-service/Dockerfile $GITHUB_WORKSPACE/publish/
9090
cd $GITHUB_WORKSPACE/publish && ls
@@ -125,7 +125,7 @@ jobs:
125125
python-version: '3.10'
126126
- name: Performance Test
127127
run: |
128-
git clone --branch=devops https://github.com/vmware/singleton.git devops
128+
git clone --branch=devops https://github.com/vmware/singleton.git jhua/devops
129129
cd $GITHUB_WORKSPACE/g11n-ws && ./gradlew build -x test
130130
cp $GITHUB_WORKSPACE/devops/performancetest/Dockerfile $GITHUB_WORKSPACE/publish/
131131
cd $GITHUB_WORKSPACE/publish && ls

g11n-ws/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Copyright 2019-2025 VMware, Inc.
1+
//Copyright 2019-2026 VMware, Inc.
22
//SPDX-License-Identifier: EPL-2.0
33

44
buildscript {

g11n-ws/vip-common/src/main/java/com/vmware/vip/common/cache/SingletonCacheImpl.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 VMware, Inc.
2+
* Copyright 2019-2026 VMware, Inc.
33
* SPDX-License-Identifier: EPL-2.0
44
*/
55
package com.vmware.vip.common.cache;
@@ -12,11 +12,14 @@
1212
import org.ehcache.config.builders.CacheManagerBuilder;
1313
import org.ehcache.xml.XmlConfiguration;
1414

15+
import java.net.URL;
1516
import java.util.ArrayList;
1617
import java.util.List;
1718

1819
public class SingletonCacheImpl implements SingletonCache{
1920

21+
private static final String EHCACHE_CONFIG_RESOURCE = "ehcache3.xml";
22+
2023
private boolean cacheEnable;
2124

2225
private CacheManager manager;
@@ -26,10 +29,34 @@ public class SingletonCacheImpl implements SingletonCache{
2629
public SingletonCacheImpl(boolean enable){
2730
this.cacheEnable = enable;
2831
if (this.cacheEnable){
29-
Configuration xmlConf = new XmlConfiguration(SingletonCacheImpl.class.getResource("/ehcache3.xml"));
30-
this.manager= CacheManagerBuilder.newCacheManager(xmlConf);
31-
this.manager.init();
32+
try {
33+
URL configUrl = getEhcacheConfigUrl();
34+
if (configUrl == null) {
35+
throw new IllegalStateException(
36+
"Ehcache config resource not found: " + EHCACHE_CONFIG_RESOURCE
37+
+ ". Ensure it is on the classpath (e.g. in src/main/resources).");
38+
}
39+
Configuration xmlConf = new XmlConfiguration(configUrl);
40+
this.manager = CacheManagerBuilder.newCacheManager(xmlConf);
41+
this.manager.init();
42+
} catch (Exception e) {
43+
String msg = e.getMessage() != null ? e.getMessage() : e.getClass().getName();
44+
throw new IllegalStateException(
45+
"Failed to initialize singleton cache: " + msg, e);
46+
}
47+
}
48+
}
49+
50+
/**
51+
* Resolve ehcache3.xml from the classpath. Tries thread context class loader first
52+
* (for Spring Boot fat jars), then the class loader of this class.
53+
*/
54+
private static URL getEhcacheConfigUrl() {
55+
URL url = Thread.currentThread().getContextClassLoader().getResource(EHCACHE_CONFIG_RESOURCE);
56+
if (url == null) {
57+
url = SingletonCacheImpl.class.getResource("/" + EHCACHE_CONFIG_RESOURCE);
3258
}
59+
return url;
3360
}
3461

3562
private <K, V> Cache<K, V> getCache(CacheName cachename, Class<K> keyType, Class<V> valueType) throws VIPCacheException{

0 commit comments

Comments
 (0)