From 87b010a5fd976ffb157e3c6e420fa1fc913d3b03 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 16 May 2023 11:49:53 +0200 Subject: [PATCH] fixed XML text masking in Title --- .../gui/content/monitoring/MonitoringRunningExam.java | 5 ++++- .../gui/service/i18n/impl/PolyglotPageServiceImpl.java | 10 +--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java index 530e0630..ea3664ac 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java @@ -18,6 +18,7 @@ import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.Function; +import org.apache.commons.text.StringEscapeUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -151,7 +152,9 @@ public class MonitoringRunningExam implements TemplateComposer { final Composite content = this.pageService.getWidgetFactory().defaultPageLayout( pageContext.getParent(), - new LocTextKey("sebserver.monitoring.exam", exam.name)); + new LocTextKey( + "sebserver.monitoring.exam", + StringEscapeUtils.escapeHtml4(exam.name))); final Composite tablePane = new Composite(content, SWT.NONE); tablePane.setLayout(new GridLayout()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java index c642653e..1ddf4989 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java @@ -11,9 +11,7 @@ package ch.ethz.seb.sebserver.gui.service.i18n.impl; import java.util.Locale; import java.util.function.Consumer; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.StringEscapeUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; @@ -271,14 +269,8 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService { final I18nSupport i18nSupport) { return label -> { - if (locTextKey != null) { - final String text = i18nSupport.getText(locTextKey); - if (BooleanUtils.toBoolean((Boolean) label.getData(RWT.MARKUP_ENABLED))) { - label.setText(StringEscapeUtils.escapeHtml4(text)); - } else { - label.setText(text); - } + label.setText(i18nSupport.getText(locTextKey)); } if (i18nSupport.hasText(locToolTipKey)) { label.setToolTipText(Utils.formatLineBreaks(i18nSupport.getText(locToolTipKey)));