Skip to content

Commit

Permalink
Fix detection of Android O/S from system properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyor Goldstein committed Sep 18, 2023
1 parent e92a46b commit ba8f36e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private static boolean resolveAndroidSettingFlag(
}

for (String p : detectionProps) {
if (detector.test(propValue)) {
if (detector.test(p)) {
flagHolder.set(Boolean.TRUE);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,19 @@ public void testSetOsTypeProgrammatically() {
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
}
Expand Down

0 comments on commit ba8f36e

Please sign in to comment.