You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/01/26 14:29:33 UTC

[tomcat] branch master updated: Simplify. attrs is never null

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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 8706f88  Simplify. attrs is never null
8706f88 is described below

commit 8706f885a61ef38a1607e5fd9ead900928e97bf1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jan 26 14:28:59 2021 +0000

    Simplify. attrs is never null
---
 java/org/apache/tomcat/util/net/LocalStrings.properties |  3 ---
 java/org/apache/tomcat/util/net/NioEndpoint.java        | 15 +--------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties b/java/org/apache/tomcat/util/net/LocalStrings.properties
index 257f4bf..bcf697c 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -97,9 +97,6 @@ endpoint.nio.keyProcessingError=Error processing selection key
 endpoint.nio.latchMustBeZero=Latch must be at count zero or null
 endpoint.nio.nullLatch=Latch cannot be null
 endpoint.nio.nullSocketChannel=Invalid null socket channel while processing poller event
-endpoint.nio.perms.execFail=Failed to set execute permissions for Unix domain socket [{0}]
-endpoint.nio.perms.readFail=Failed to set read permissions for Unix domain socket [{0}]
-endpoint.nio.perms.writeFail=Failed to set write permissions for Unix domain socket [{0}]
 endpoint.nio.pollerEventError=Error processing poller event
 endpoint.nio.registerFail=Failed to register socket with selector from poller
 endpoint.nio.selectorCloseFail=Failed to close selector when closing the poller
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 4345ed0..5ce6398 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -211,20 +211,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                 FileAttribute<Set<PosixFilePermission>> attrs =
                         PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(getUnixDomainSocketPathPermissions()));
                 Path path = Paths.get(getUnixDomainSocketPath());
-                if (attrs != null) {
-                    Files.setAttribute(path, attrs.name(), attrs.value());
-                } else {
-                    java.io.File file = path.toFile();
-                    if (!file.setReadable(true, false)) {
-                        log.warn(sm.getString("endpoint.nio.perms.readFail", path));
-                    }
-                    if (!file.setWritable(true, false)) {
-                        log.warn(sm.getString("endpoint.nio.perms.writeFail", path));
-                    }
-                    if (!file.setExecutable(false, false)) {
-                        log.warn(sm.getString("endpoint.nio.perms.execFail", path));
-                    }
-                }
+                Files.setAttribute(path, attrs.name(), attrs.value());
             }
         } else {
             serverSock = ServerSocketChannel.open();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org