You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2024/12/12 12:26:33 UTC

(sling-org-apache-sling-serviceuser-webconsole) branch master updated (1dc5bff -> d5b95a6)

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

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


    from 1dc5bff  SLING-12459 - Redirect sonarcloud notifications to commits@apache.sling.org
     new 6c6e6b7  SLING-12550 Update to parent 62
     new d5b95a6  SLING-12550 apply spotless formatting

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:
 .sling-module.json                                 |   5 +
 pom.xml                                            | 271 +++++++++++----------
 .../impl/ServiceUserWebConsolePlugin.java          | 155 ++++++++----
 3 files changed, 242 insertions(+), 189 deletions(-)
 create mode 100644 .sling-module.json


(sling-org-apache-sling-serviceuser-webconsole) 02/02: SLING-12550 apply spotless formatting

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

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

commit d5b95a6567cc29f4756920c17ea32f36db0948c5
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Dec 12 13:16:35 2024 +0100

    SLING-12550 apply spotless formatting
---
 pom.xml                                            | 277 ++++++++++-----------
 .../impl/ServiceUserWebConsolePlugin.java          | 155 ++++++++----
 2 files changed, 237 insertions(+), 195 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8e50977..d5f4c63 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
 	license agreements. See the NOTICE file distributed with this work for additional 
 	information regarding copyright ownership. The ASF licenses this file to 
@@ -11,154 +11,149 @@
 	language governing permissions and limitations under the License. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.apache.sling</groupId>
-		<artifactId>sling-bundle-parent</artifactId>
-		<version>62</version>
-		<relativePath />
-	</parent>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-bundle-parent</artifactId>
+        <version>62</version>
+        <relativePath />
+    </parent>
 
-	<artifactId>org.apache.sling.serviceuser.webconsole</artifactId>
-	<version>1.0.3-SNAPSHOT</version>
+    <artifactId>org.apache.sling.serviceuser.webconsole</artifactId>
+    <version>1.0.3-SNAPSHOT</version>
 
-	<name>Apache Sling Service User Web Console</name>
-	<description>
-        Provides an OSGi Web Console for creating, updating and viewing Service Users.
-    </description>
+    <name>Apache Sling Service User Web Console</name>
+    <description>Provides an OSGi Web Console for creating, updating and viewing Service Users.</description>
 
-	<scm>
-		<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceuser-webconsole.git</connection>
-		<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceuser-webconsole.git</developerConnection>
-		<url>https://github.com/apache/sling-org-apache-sling-serviceuser-webconsole.git</url>
-		<tag>HEAD</tag>
-	</scm>
+    <scm>
+        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceuser-webconsole.git</connection>
+        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceuser-webconsole.git</developerConnection>
+        <tag>HEAD</tag>
+        <url>https://github.com/apache/sling-org-apache-sling-serviceuser-webconsole.git</url>
+    </scm>
 
-	<properties>
-		<sling.java.version>8</sling.java.version>
-		<project.build.outputTimestamp>1</project.build.outputTimestamp>
-	</properties>
+    <properties>
+        <sling.java.version>8</sling.java.version>
+        <project.build.outputTimestamp>1</project.build.outputTimestamp>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.5.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.serviceusermapper</artifactId>
+            <version>1.4.0</version>
+            <scope>provided</scope>
+        </dependency>
 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>biz.aQute.bnd</groupId>
-				<artifactId>bnd-maven-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-javadoc-plugin</artifactId>
-				<configuration>
-					<excludePackageNames>
-						org.apache.sling.serviceuser.console.impl
-					</excludePackageNames>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.sling</groupId>
-			<artifactId>org.apache.sling.api</artifactId>
-			<version>2.5.0</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.sling</groupId>
-			<artifactId>org.apache.sling.serviceusermapper</artifactId>
-			<version>1.4.0</version>
-			<scope>provided</scope>
-		</dependency>
+        <!-- JCR Specific items -->
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-api</artifactId>
+            <version>2.10.6</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.base</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-commons</artifactId>
+            <version>2.0.0</version>
+            <scope>provided</scope>
+        </dependency>
 
-		<!-- JCR Specific items -->
-		<dependency>
-			<groupId>org.apache.jackrabbit</groupId>
-			<artifactId>jackrabbit-api</artifactId>
-			<version>2.10.6</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.jcr</groupId>
-			<artifactId>jcr</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.sling</groupId>
-			<artifactId>org.apache.sling.jcr.base</artifactId>
-			<version>2.1.0</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.jackrabbit</groupId>
-			<artifactId>jackrabbit-jcr-commons</artifactId>
-			<version>2.0.0</version>
-			<scope>provided</scope>
-		</dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.framework</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>provided</scope>
+        </dependency>
 
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-api</artifactId>
-			<scope>provided</scope>
-		</dependency>
+        <!-- Webconsole Dependencies -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.webconsole</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.xss</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
 
-		<dependency>
-			<groupId>org.osgi</groupId>
-			<artifactId>org.osgi.framework</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.osgi</groupId>
-			<artifactId>org.osgi.service.component</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.osgi</groupId>
-			<artifactId>org.osgi.service.component.annotations</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>javax.servlet-api</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-lang3</artifactId>
-			<version>3.3.2</version>
-			<scope>provided</scope>
-		</dependency>
+        <!-- Testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>4.5.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
-		<!-- Webconsole Dependencies -->
-		<dependency>
-			<groupId>org.apache.felix</groupId>
-			<artifactId>org.apache.felix.webconsole</artifactId>
-			<version>4.2.0</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.sling</groupId>
-			<artifactId>org.apache.sling.xss</artifactId>
-			<version>1.0.0</version>
-			<scope>provided</scope>
-		</dependency>
-
-		<!-- Testing -->
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-simple</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.mockito</groupId>
-			<artifactId>mockito-core</artifactId>
-			<version>4.5.1</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <excludePackageNames>org.apache.sling.serviceuser.console.impl</excludePackageNames>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/src/main/java/org/apache/sling/serviceuser/webconsole/impl/ServiceUserWebConsolePlugin.java b/src/main/java/org/apache/sling/serviceuser/webconsole/impl/ServiceUserWebConsolePlugin.java
index ae5eba6..e8bd922 100644
--- a/src/main/java/org/apache/sling/serviceuser/webconsole/impl/ServiceUserWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/serviceuser/webconsole/impl/ServiceUserWebConsolePlugin.java
@@ -18,6 +18,20 @@
  */
 package org.apache.sling.serviceuser.webconsole.impl;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.query.Query;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlList;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.Privilege;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.reflect.Array;
@@ -36,20 +50,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.query.Query;
-import javax.jcr.security.AccessControlEntry;
-import javax.jcr.security.AccessControlList;
-import javax.jcr.security.AccessControlManager;
-import javax.jcr.security.AccessControlPolicy;
-import javax.jcr.security.Privilege;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -89,11 +89,14 @@ import org.slf4j.LoggerFactory;
 /**
  * Web console plugin to test configuration resolution.
  */
-@Component(service = Servlet.class, property = {
-        Constants.SERVICE_DESCRIPTION + "=Apache Sling Service User Manager Web Console Plugin",
-        WebConsoleConstants.PLUGIN_LABEL + "=" + ServiceUserWebConsolePlugin.LABEL,
-        WebConsoleConstants.PLUGIN_TITLE + "=" + ServiceUserWebConsolePlugin.TITLE,
-        WebConsoleConstants.PLUGIN_CATEGORY + "=Sling" })
+@Component(
+        service = Servlet.class,
+        property = {
+            Constants.SERVICE_DESCRIPTION + "=Apache Sling Service User Manager Web Console Plugin",
+            WebConsoleConstants.PLUGIN_LABEL + "=" + ServiceUserWebConsolePlugin.LABEL,
+            WebConsoleConstants.PLUGIN_TITLE + "=" + ServiceUserWebConsolePlugin.TITLE,
+            WebConsoleConstants.PLUGIN_CATEGORY + "=Sling"
+        })
 @SuppressWarnings("serial")
 public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
 
@@ -102,7 +105,8 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
     private static final String TR = "</tr>";
     private static final String STYLE_WIDTH_100 = "' style='width:100%' />";
     private static final String TD_STYLE_WIDTH_20 = "<td style='width:20%'>";
-    public static final String COMPONENT_NAME = "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended";
+    public static final String COMPONENT_NAME =
+            "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended";
     public static final String LABEL = "serviceusers";
     public static final String TITLE = "Service Users";
 
@@ -132,8 +136,10 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
 
         String appPath = getParameter(request, PN_APP_PATH, "");
 
-        Iterator<Resource> configs = resolver.findResources("SELECT * FROM [sling:OsgiConfig] WHERE ISDESCENDANTNODE(["
-                + appPath + "]) AND NAME() LIKE '" + COMPONENT_NAME + "%'", Query.JCR_SQL2);
+        Iterator<Resource> configs = resolver.findResources(
+                "SELECT * FROM [sling:OsgiConfig] WHERE ISDESCENDANTNODE([" + appPath + "]) AND NAME() LIKE '"
+                        + COMPONENT_NAME + "%'",
+                Query.JCR_SQL2);
 
         try {
             boolean dirty = false;
@@ -143,13 +149,16 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
                 config = configs.next();
                 log.debug("Using existing configuration {}", config);
             } else {
-                String path = appPath + "/config/" + COMPONENT_NAME + "-"
-                        + appPath.substring(appPath.lastIndexOf('/') + 1);
+                String path =
+                        appPath + "/config/" + COMPONENT_NAME + "-" + appPath.substring(appPath.lastIndexOf('/') + 1);
                 log.debug("Creating new configuration {}", path);
 
-                config = ResourceUtil.getOrCreateResource(resolver, path,
+                config = ResourceUtil.getOrCreateResource(
+                        resolver,
+                        path,
                         Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, (Object) "sling:OsgiConfig"),
-                        NodeType.NT_FOLDER, false);
+                        NodeType.NT_FOLDER,
+                        false);
                 dirty = true;
             }
 
@@ -214,7 +223,6 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
                 resolver.close();
             }
         }
-
     }
 
     private void processRequest(HttpServletRequest request, HttpServletResponse response, ResourceResolver resolver)
@@ -235,8 +243,8 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
                     params.add(PN_USER + "="
                             + URLEncoder.encode(userResource.getName(), StandardCharsets.UTF_8.toString()));
 
-                    WebConsoleUtil.sendRedirect(request, response,
-                            "/system/console/" + LABEL + "?" + StringUtils.join(params, "&"));
+                    WebConsoleUtil.sendRedirect(
+                            request, response, "/system/console/" + LABEL + "?" + StringUtils.join(params, "&"));
                 } else {
                     sendErrorRedirect(request, response, "Unable to update service user permissions!");
                 }
@@ -270,8 +278,9 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
             Resource aclResource = aclResources.next();
             affectedPaths.add(aclResource.getPath());
             ValueMap properties = aclResource.adaptTo(ValueMap.class);
-            String acl = aclResource.getPath().substring(0, aclResource.getPath().indexOf("/rep:policy")) + "="
-                    + StringUtils.join(properties.get("rep:privileges", String[].class), ",");
+            String acl =
+                    aclResource.getPath().substring(0, aclResource.getPath().indexOf("/rep:policy")) + "="
+                            + StringUtils.join(properties.get("rep:privileges", String[].class), ",");
             acls.add(acl);
         }
         return acls.toArray(new String[acls.size()]);
@@ -440,7 +449,8 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
      */
     protected URL getResource(String path) {
         String base = "/" + LABEL + "/";
-        return (path != null && path.startsWith(base)) ? getClass().getResource(path.substring(base.length() - 1))
+        return (path != null && path.startsWith(base))
+                ? getClass().getResource(path.substring(base.length() - 1))
                 : null;
     }
 
@@ -517,7 +527,9 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
             @Override
             public int compare(Pair<String, Mapping> o1, Pair<String, Mapping> o2) {
                 if (o1.getKey().equals(o2.getKey())) {
-                    return o1.getValue().getServiceName().compareTo(o2.getValue().getServiceName());
+                    return o1.getValue()
+                            .getServiceName()
+                            .compareTo(o2.getValue().getServiceName());
                 } else {
                     return o1.getKey().compareTo(o2.getKey());
                 }
@@ -541,16 +553,22 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
             } else {
                 bundleContext.getBundle();
                 pw.println("<td>" + xss.encodeForHTML(mapping.getValue().getServiceName()) + TD);
-                pw.println("<td>" + xss.encodeForHTML(
-                        mapping.getValue().getSubServiceName() != null ? mapping.getValue().getSubServiceName() : "")
+                pw.println("<td>"
+                        + xss.encodeForHTML(
+                                mapping.getValue().getSubServiceName() != null
+                                        ? mapping.getValue().getSubServiceName()
+                                        : "")
                         + TD);
             }
         }
-
     }
 
-    private void printPrivilegeSelect(PrintWriter pw, String label, List<Pair<String, String>> privileges,
-            String[] supportedPrivileges, String alertMessage) {
+    private void printPrivilegeSelect(
+            PrintWriter pw,
+            String label,
+            List<Pair<String, String>> privileges,
+            String[] supportedPrivileges,
+            String alertMessage) {
         pw.print(TD_STYLE_WIDTH_20);
         pw.print(xss.encodeForHTMLAttr(label));
         pw.println(TD);
@@ -688,29 +706,46 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
 
         tableRows(pw);
         String userContextPath = getParameter(request, PN_USER_PATH, "");
-        textField(pw, "Intermediate Path", PN_USER_PATH, userContextPath,
+        textField(
+                pw,
+                "Intermediate Path",
+                PN_USER_PATH,
+                userContextPath,
                 "Optional: The intermediate path under which to create the user. Should start with system, e.g. system/myapp");
 
         tableRows(pw);
         String bundle = getParameter(request, PN_BUNDLE, "");
-        selectField(pw, "Bundle", PN_BUNDLE, bundle, getBundles(),
+        selectField(
+                pw,
+                "Bundle",
+                PN_BUNDLE,
+                bundle,
+                getBundles(),
                 "The bundle from which this service user will be useable");
 
         tableRows(pw);
         String serviceName = getParameter(request, PN_SUB_SERVICE, "");
-        textField(pw, "Sub Service Name", PN_SUB_SERVICE, serviceName,
+        textField(
+                pw,
+                "Sub Service Name",
+                PN_SUB_SERVICE,
+                serviceName,
                 "Optional: Allows for different permissions for different services within a bundle");
 
         tableRows(pw);
         String appPath = getParameter(request, PN_APP_PATH, "");
-        textField(pw, "Application Path", PN_APP_PATH, appPath,
+        textField(
+                pw,
+                "Application Path",
+                PN_APP_PATH,
+                appPath,
                 "The application under which to create the OSGi Configuration for the Service User Mapping, e.g. /apps/myapp");
 
         tableRows(pw);
 
         List<Pair<String, String>> privileges = getPrivileges(request);
-        printPrivilegeSelect(pw, "ACLs", privileges, getSupportedPrivileges(request),
-                "Set the privileges for this service user");
+        printPrivilegeSelect(
+                pw, "ACLs", privileges, getSupportedPrivileges(request), "Set the privileges for this service user");
 
         tableRows(pw);
 
@@ -751,7 +786,9 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
         String action = getParameter(request, PN_ACTION, "");
         if (StringUtils.isBlank(action)) {
             log.debug("Rendering service users page");
-            info(pw, "Service users are used by OSGi Services to access the Sling repository. Use this form to find and create service users.");
+            info(
+                    pw,
+                    "Service users are used by OSGi Services to access the Sling repository. Use this form to find and create service users.");
 
             try {
                 printServiceUsers(request, pw);
@@ -772,7 +809,12 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
         }
     }
 
-    private void selectField(PrintWriter pw, String label, String fieldName, String value, Collection<String> options,
+    private void selectField(
+            PrintWriter pw,
+            String label,
+            String fieldName,
+            String value,
+            Collection<String> options,
             String... alertMessages) {
         pw.print(TD_STYLE_WIDTH_20);
         pw.print(xss.encodeForHTMLAttr(label));
@@ -799,7 +841,7 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
     private void sendErrorRedirect(HttpServletRequest request, HttpServletResponse response, String alert)
             throws IOException {
         List<String> params = new ArrayList<>();
-        for (String param : new String[] { PN_APP_PATH, PN_BUNDLE, PN_NAME, PN_SUB_SERVICE, PN_USER_PATH }) {
+        for (String param : new String[] {PN_APP_PATH, PN_BUNDLE, PN_NAME, PN_SUB_SERVICE, PN_USER_PATH}) {
             params.add(param + "="
                     + URLEncoder.encode(this.getParameter(request, param, ""), StandardCharsets.UTF_8.toString()));
         }
@@ -817,8 +859,8 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
             params.add(PN_ALERT + "=" + URLEncoder.encode(alert, "UTF-8"));
         }
 
-        WebConsoleUtil.sendRedirect(request, response,
-                "/system/console/" + LABEL + "?" + StringUtils.join(params, "&"));
+        WebConsoleUtil.sendRedirect(
+                request, response, "/system/console/" + LABEL + "?" + StringUtils.join(params, "&"));
     }
 
     private void tableEnd(PrintWriter pw) {
@@ -860,7 +902,8 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
             if (value.getClass().isArray()) {
                 for (int i = 0; i < Array.getLength(value); i++) {
                     Object itemValue = Array.get(value, i);
-                    pw.print(xss.encodeForHTML(ObjectUtils.defaultIfNull(itemValue, "").toString()));
+                    pw.print(xss.encodeForHTML(
+                            ObjectUtils.defaultIfNull(itemValue, "").toString()));
                     pw.println("<br>");
                 }
             } else {
@@ -943,9 +986,14 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
                     }
                 }
                 Principal principal = principalManager.getPrincipal(name);
-                AccessControlUtil.replaceAccessControlEntry(session, pol.getKey(), principal,
-                        pol.getValue().toArray(new String[pol.getValue().size()]), new String[0],
-                        toRemove.toArray(new String[toRemove.size()]), null);
+                AccessControlUtil.replaceAccessControlEntry(
+                        session,
+                        pol.getKey(),
+                        principal,
+                        pol.getValue().toArray(new String[pol.getValue().size()]),
+                        new String[0],
+                        toRemove.toArray(new String[toRemove.size()]),
+                        null);
             }
             session.save();
 
@@ -984,5 +1032,4 @@ public class ServiceUserWebConsolePlugin extends AbstractWebConsolePlugin {
 
         return true;
     }
-
 }


(sling-org-apache-sling-serviceuser-webconsole) 01/02: SLING-12550 Update to parent 62

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

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

commit 6c6e6b7027e72ba8b7c52466fab8cdbc5ac55f26
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Dec 12 13:15:51 2024 +0100

    SLING-12550 Update to parent 62
---
 .sling-module.json |  5 +++++
 pom.xml            | 10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.sling-module.json b/.sling-module.json
new file mode 100644
index 0000000..cfad4d2
--- /dev/null
+++ b/.sling-module.json
@@ -0,0 +1,5 @@
+{
+  "jenkins": {
+    "jdks": [17, 21]
+  }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9e82ca5..8e50977 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
 	<parent>
 		<groupId>org.apache.sling</groupId>
 		<artifactId>sling-bundle-parent</artifactId>
-		<version>47</version>
+		<version>62</version>
 		<relativePath />
 	</parent>
 
@@ -80,6 +80,7 @@
 		<dependency>
 			<groupId>javax.jcr</groupId>
 			<artifactId>jcr</artifactId>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.sling</groupId>
@@ -98,11 +99,13 @@
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
+			<scope>provided</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.osgi</groupId>
-			<artifactId>osgi.core</artifactId>
+			<artifactId>org.osgi.framework</artifactId>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
@@ -117,6 +120,7 @@
 		<dependency>
 			<groupId>javax.servlet</groupId>
 			<artifactId>javax.servlet-api</artifactId>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.commons</groupId>
@@ -143,10 +147,12 @@
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
+			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-simple</artifactId>
+			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.mockito</groupId>