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

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git


The following commit(s) were added to refs/heads/master by this push:
     new ba8f36e44 Fix detection of Android O/S from system properties
ba8f36e44 is described below

commit ba8f36e4441f5f0ca27e34e667a3e1485ac48b33
Author: Lyor Goldstein <lgoldst...@apache.org>
AuthorDate: Mon Sep 18 18:59:57 2023 +0300

    Fix detection of Android O/S from system properties
---
 CHANGES.md                                                             | 1 +
 sshd-common/src/main/java/org/apache/sshd/common/util/OsUtils.java     | 2 +-
 sshd-common/src/test/java/org/apache/sshd/common/util/OsUtilsTest.java | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 5a6cc7bf1..3b1d228f4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -37,6 +37,7 @@
 * [GH-410](https://github.com/apache/mina-sshd/issues/410) Fix a race 
condition to ensure `SSH_MSG_CHANNEL_EOF` is always sent before 
`SSH_MSG_CHANNEL_CLOSE`.
 * [GH-414](https://github.com/apache/mina-sshd/issues/414) Fix error handling 
while flushing queued packets at end of KEX.
 
+* [SSHD-789](https://issues.apache.org/jira/browse/SSHD-789) Fix detection of 
Android O/S from system properties.
 * [SSHD-1259](https://issues.apache.org/jira/browse/SSHD-1259) Consider all 
applicable host keys from the known_hosts files.
 * [SSHD-1310](https://issues.apache.org/jira/browse/SSHD-1310) 
`SftpFileSystem`: do not close user session.
 * [SSHD-1327](https://issues.apache.org/jira/browse/SSHD-1327) 
`ChannelAsyncOutputStream`: remove write future when done.
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/OsUtils.java 
b/sshd-common/src/main/java/org/apache/sshd/common/util/OsUtils.java
index eceac13e5..bbad68982 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/util/OsUtils.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/util/OsUtils.java
@@ -224,7 +224,7 @@ public final class OsUtils {
             }
 
             for (String p : detectionProps) {
-                if (detector.test(propValue)) {
+                if (detector.test(p)) {
                     flagHolder.set(Boolean.TRUE);
                     return true;
                 }
diff --git 
a/sshd-common/src/test/java/org/apache/sshd/common/util/OsUtilsTest.java 
b/sshd-common/src/test/java/org/apache/sshd/common/util/OsUtilsTest.java
index 5470d0f20..76073b42f 100644
--- a/sshd-common/src/test/java/org/apache/sshd/common/util/OsUtilsTest.java
+++ b/sshd-common/src/test/java/org/apache/sshd/common/util/OsUtilsTest.java
@@ -65,16 +65,19 @@ public class OsUtilsTest extends JUnitTestSupport {
             assertEquals("Mismatched detection value", false, OsUtils.isOSX());
             assertEquals("Mismatched detection value", false, 
OsUtils.isUNIX());
             assertEquals("Mismatched detection value", true, 
OsUtils.isWin32());
+            assertEquals("Mismatched detection value", false, 
OsUtils.isAndroid());
 
             OsUtils.setOS("mac os");
             assertEquals("Mismatched detection value", true, OsUtils.isOSX());
             assertEquals("Mismatched detection value", false, 
OsUtils.isUNIX());
             assertEquals("Mismatched detection value", false, 
OsUtils.isWin32());
+            assertEquals("Mismatched detection value", false, 
OsUtils.isAndroid());
 
             OsUtils.setOS("linux");
             assertEquals("Mismatched detection value", false, OsUtils.isOSX());
             assertEquals("Mismatched detection value", true, OsUtils.isUNIX());
             assertEquals("Mismatched detection value", false, 
OsUtils.isWin32());
+            assertEquals("Mismatched detection value", false, 
OsUtils.isAndroid());
         } finally {
             OsUtils.setOS(null); // force re-detection
         }

Reply via email to