You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2021/12/15 15:49:15 UTC

[sling-org-apache-sling-commons-log-webconsole] branch master updated (842cab0 -> 868da31)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-log-webconsole.git.


    from 842cab0  SLING-11005 - Remove logback dependency from pom
     new 14eb418  SLING-11007 - commons.log.webconsole: upgrade to parent pom 46
     new 868da31  SLING-11007 - commons.log.webconsole: upgrade to parent pom 46

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 bnd.bnd                                            |  4 +++
 pom.xml                                            | 41 +++++-----------------
 .../commons/log/webconsole/internal/Activator.java |  3 ++
 .../webconsole/internal/LogWebConsolePlugin.java   | 22 +++++++-----
 4 files changed, 28 insertions(+), 42 deletions(-)
 create mode 100644 bnd.bnd

[sling-org-apache-sling-commons-log-webconsole] 02/02: SLING-11007 - commons.log.webconsole: upgrade to parent pom 46

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-log-webconsole.git

commit 868da31295133ac90f5820d0dbf2ab515592423a
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Wed Dec 15 16:32:35 2021 +0100

    SLING-11007 - commons.log.webconsole: upgrade to parent pom 46
    
    - update to the latest parent pom
    - switch to the bnd-maven-plugin
    - update to the latest felix framework
---
 bnd.bnd                                            |  4 +++
 pom.xml                                            | 36 +++++-----------------
 .../commons/log/webconsole/internal/Activator.java |  3 ++
 3 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
new file mode 100644
index 0000000..e2688a2
--- /dev/null
+++ b/bnd.bnd
@@ -0,0 +1,4 @@
+Bundle-DocURL: http://sling.apache.org/site/logging.html
+Import-Package: javax.servlet; \
+              javax.servlet.http;version=2.3, \
+              *
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 571c152..007a733 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,14 +22,13 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.sling</groupId>
-    <artifactId>sling</artifactId>
-    <version>30</version>
+    <artifactId>sling-bundle-parent</artifactId>
+    <version>46</version>
     <relativePath />
   </parent>
 
   <artifactId>org.apache.sling.commons.log.webconsole</artifactId>
   <version>1.0.1-SNAPSHOT</version>
-  <packaging>bundle</packaging>
 
   <name>Apache Sling Log WebConsole</name>
   <description>
@@ -45,6 +44,7 @@
   <properties>
     <slf4j.version>1.7.21</slf4j.version>
     <pax-exam.version>4.13.3</pax-exam.version>
+    <project.build.outputTimestamp>10</project.build.outputTimestamp>
 
     <bundle.build.dir>
       ${basedir}/target
@@ -56,30 +56,6 @@
 
   <build>
     <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Activator>
-              org.apache.sling.commons.log.webconsole.internal.Activator
-            </Bundle-Activator>
-            <Bundle-DocURL>
-              http://sling.apache.org/site/logging.html
-            </Bundle-DocURL>
-            <Embed-Dependency>
-              org.apache.sling.commons.osgi;inline=
-              org/apache/sling/commons/osgi/PropertiesUtil*.class
-            </Embed-Dependency>
-            <Import-Package>
-              javax.servlet;
-              javax.servlet.http;version=2.3,
-              *
-            </Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
       <!-- Required for pax exam-->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
@@ -214,6 +190,10 @@
       <artifactId>osgi.core</artifactId>
     </dependency>
     <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.annotation.bundle</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.webconsole</artifactId>
       <version>4.3.0</version>
@@ -243,7 +223,7 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>5.6.0</version>
+      <version>7.0.1</version>
       <scope>test</scope>
     </dependency>
 
diff --git a/src/main/java/org/apache/sling/commons/log/webconsole/internal/Activator.java b/src/main/java/org/apache/sling/commons/log/webconsole/internal/Activator.java
index dd8c2f6..c776cd6 100644
--- a/src/main/java/org/apache/sling/commons/log/webconsole/internal/Activator.java
+++ b/src/main/java/org/apache/sling/commons/log/webconsole/internal/Activator.java
@@ -20,11 +20,14 @@
 package org.apache.sling.commons.log.webconsole.internal;
 
 import org.apache.sling.commons.log.logback.webconsole.LogPanel;
+import org.osgi.annotation.bundle.Header;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.ServiceTracker;
 
+@Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}")
 public class Activator implements BundleActivator {
     private ServiceTracker<LogPanel, LogWebConsolePlugin> panelTracker;
 

[sling-org-apache-sling-commons-log-webconsole] 01/02: SLING-11007 - commons.log.webconsole: upgrade to parent pom 46

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-log-webconsole.git

commit 14eb4181a8b1ffdde9e8722d6f13687e0e29b783
Author: Robert Munteanu <ro...@apache.org>
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);