This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch issue/SLING-11007 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-log-webconsole.git
commit 2a405686188619257c3c688cbe49f5a5e24ae6a9 Author: Robert Munteanu <[email protected]> AuthorDate: Wed Dec 15 16:31:38 2021 +0100 SLING-11007 - commons.log.webconsole: upgrade to parent pom 46 Stop using o.a.s.commons.osgi, it's not intended to parse request parameters. --- pom.xml | 5 ----- .../webconsole/internal/LogWebConsolePlugin.java | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index fffa51c..571c152 100644 --- a/pom.xml +++ b/pom.xml @@ -207,11 +207,6 @@ <artifactId>org.apache.sling.commons.log</artifactId> <version>5.0.2</version> </dependency> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.commons.osgi</artifactId> - <version>2.2.0</version> - </dependency> <!-- OSGi Libraries not included here --> <dependency> diff --git a/src/main/java/org/apache/sling/commons/log/webconsole/internal/LogWebConsolePlugin.java b/src/main/java/org/apache/sling/commons/log/webconsole/internal/LogWebConsolePlugin.java index 3c3770f..b92ef5e 100644 --- a/src/main/java/org/apache/sling/commons/log/webconsole/internal/LogWebConsolePlugin.java +++ b/src/main/java/org/apache/sling/commons/log/webconsole/internal/LogWebConsolePlugin.java @@ -19,6 +19,12 @@ package org.apache.sling.commons.log.webconsole.internal; +import static org.apache.sling.commons.log.logback.webconsole.LogPanel.APP_ROOT; +import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_APPENDER_NAME; +import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_TAIL_GREP; +import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_TAIL_NUM_OF_LINES; +import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PATH_TAILER; + import java.io.IOException; import java.io.PrintWriter; @@ -30,13 +36,6 @@ import org.apache.felix.webconsole.SimpleWebConsolePlugin; import org.apache.sling.commons.log.logback.webconsole.LogPanel; import org.apache.sling.commons.log.logback.webconsole.LoggerConfig; import org.apache.sling.commons.log.logback.webconsole.TailerOptions; -import org.apache.sling.commons.osgi.PropertiesUtil; - -import static org.apache.sling.commons.log.logback.webconsole.LogPanel.APP_ROOT; -import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_APPENDER_NAME; -import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_TAIL_NUM_OF_LINES; -import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PARAM_TAIL_GREP; -import static org.apache.sling.commons.log.logback.webconsole.LogPanel.PATH_TAILER; public class LogWebConsolePlugin extends SimpleWebConsolePlugin { private static final String RES_LOC = LogPanel.APP_ROOT + "/res/ui"; @@ -69,7 +68,12 @@ public class LogWebConsolePlugin extends SimpleWebConsolePlugin { pw.printf("Provide appender name via [%s] request parameter%n", PARAM_APPENDER_NAME); return; } - int numOfLines = PropertiesUtil.toInteger(req.getParameter(PARAM_TAIL_NUM_OF_LINES), 0); + int numOfLines = 0 ; + try { + numOfLines = Integer.valueOf(req.getParameter(PARAM_TAIL_NUM_OF_LINES)); + } catch ( NumberFormatException e ) { + // ignore + } TailerOptions opts = new TailerOptions(numOfLines, regex); panel.tail(pw, appenderName, opts); return; @@ -100,7 +104,7 @@ public class LogWebConsolePlugin extends SimpleWebConsolePlugin { String logger = req.getParameter("logger"); String logLevel = req.getParameter("loglevel"); String logFile = req.getParameter("logfile"); - boolean additive = PropertiesUtil.toBoolean(req.getParameter("logAdditive"), false); + boolean additive = Boolean.parseBoolean(req.getParameter("logAdditive")); String[] loggers = req.getParameterValues("logger"); if (null != logger) { LoggerConfig config = new LoggerConfig(pid, logLevel, loggers, logFile, additive);
