Skip to content

Commit dd25354

Browse files
committed
Removed basePath handling in CacheableProvider.
1 parent 2f56a55 commit dd25354

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.JanLoebel</groupId>
77
<artifactId>json-schema-validation-starter</artifactId>
8-
<version>2.0.0-SNAPSHOT</version>
8+
<version>2.1.0-SNAPSHOT</version>
99

1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/com/github/JanLoebel/jsonschemavalidation/provider/CacheableJsonSchemaProvider.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,18 @@
88
public class CacheableJsonSchemaProvider extends DefaultJsonSchemaProvider {
99

1010
private final Map<String, JsonSchema> cache = new ConcurrentHashMap<>();
11-
private final String basePath;
12-
13-
public CacheableJsonSchemaProvider(String basePath) {
14-
this.basePath = basePath;
15-
}
16-
17-
public CacheableJsonSchemaProvider() {
18-
this("");
19-
}
2011

2112
@Override
2213
public JsonSchema loadSchema(String url) {
23-
final String fullPath = basePath + url;
24-
if (cache.containsKey(fullPath)) {
25-
return cache.get(fullPath);
14+
if (cache.containsKey(url)) {
15+
return cache.get(url);
2616
}
2717

28-
return putToCache(fullPath, super.loadSchema(fullPath));
18+
return putToCache(url, super.loadSchema(url));
2919
}
3020

31-
private JsonSchema putToCache(String fullPath, JsonSchema jsonSchema) {
32-
cache.put(fullPath, jsonSchema);
21+
private JsonSchema putToCache(String url, JsonSchema jsonSchema) {
22+
cache.put(url, jsonSchema);
3323
return jsonSchema;
3424
}
3525

0 commit comments

Comments
 (0)