Handle fields in yaml config files with "/" - fix for #3533

This commit is contained in:
Mike Primm 2021-12-05 20:32:22 -06:00
parent 2ef6bf35a5
commit a40830434d
3 changed files with 20 additions and 14 deletions

View File

@ -6,7 +6,7 @@ dependencies {
implementation 'org.eclipse.jetty:jetty-server:9.4.26.v20200117'
implementation 'org.eclipse.jetty:jetty-servlet:9.4.26.v20200117'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'org.yaml:snakeyaml:1.23'
implementation 'org.yaml:snakeyaml:1.29'
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
implementation 'org.postgresql:postgresql:42.2.18'
}

View File

@ -138,9 +138,11 @@ public class ConfigurationNode implements Map<String, Object> {
public Object getObject(String path) {
if (path.isEmpty())
return entries;
// Try get first (in case '/' is legit part
Object v = get(path);
int separator = path.indexOf('/');
if (separator < 0)
return get(path);
if ((v != null) || (separator < 0)) return v;
String localKey = path.substring(0, separator);
Object subvalue = get(localKey);
if (subvalue == null)

View File

@ -455,7 +455,8 @@ class MarkerSetImpl implements MarkerSet {
if (markernode != null) {
for(String id : markernode.keySet()) {
MarkerImpl marker = new MarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(markernode.getNode(id))) {
ConfigurationNode cfg = markernode.getNode(id);
if ((cfg != null) && marker.loadPersistentData(cfg)) {
markers.put(id, marker);
}
else {
@ -468,7 +469,8 @@ class MarkerSetImpl implements MarkerSet {
if (areamarkernode != null) {
for(String id : areamarkernode.keySet()) {
AreaMarkerImpl marker = new AreaMarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(areamarkernode.getNode(id))) {
ConfigurationNode cfg = areamarkernode.getNode(id);
if ((cfg != null) && marker.loadPersistentData(cfg)) {
areamarkers.put(id, marker);
if(marker.getBoostFlag()) {
if(boostingareamarkers == null) {
@ -493,7 +495,8 @@ class MarkerSetImpl implements MarkerSet {
if (linemarkernode != null) {
for(String id : linemarkernode.keySet()) {
PolyLineMarkerImpl marker = new PolyLineMarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(linemarkernode.getNode(id))) {
ConfigurationNode cfg = linemarkernode.getNode(id);
if ((cfg != null) && marker.loadPersistentData(cfg)) {
linemarkers.put(id, marker);
}
else {
@ -506,7 +509,8 @@ class MarkerSetImpl implements MarkerSet {
if (circlemarkernode != null) {
for(String id : circlemarkernode.keySet()) {
CircleMarkerImpl marker = new CircleMarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(circlemarkernode.getNode(id))) {
ConfigurationNode cfg = circlemarkernode.getNode(id);
if ((cfg != null) && marker.loadPersistentData(cfg)) {
circlemarkers.put(id, marker);
if(marker.getBoostFlag()) {
if(boostingcirclemarkers == null) {