Skip to content

Commit b53f428

Browse files
committed
inode, device: imrprove robustness
1 parent f8163b8 commit b53f428

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

+stdlib/+dotnet/device.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@
2727

2828
delete(h)
2929

30+
i = uint64(i);
31+
3032
end

+stdlib/+python/device.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
function i = device(p)
22

3+
i = [];
34
try
4-
i = uint64(int64(py.os.stat(p).st_dev));
5+
i = int64(py.os.stat(p).st_dev);
56
% int64 first is for Matlab <= R2022a
67
catch e
7-
warning(e.identifier, "device(%s) failed: %s", p, e.message)
8-
i = [];
8+
if ~contains(e.message, "FileNotFoundError")
9+
warning(e.identifier, "device(%s) failed: %s", p, e.message)
10+
end
911
end
1012

13+
i = uint64(i);
14+
1115
end

+stdlib/+python/inode.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
function i = inode(p)
22

3+
i = [];
4+
35
try
46
i = int64(py.os.stat(p).st_ino);
57
% int64 first is for Matlab <= R2022a
68
catch e
7-
warning(e.identifier, "%s", e.message)
8-
i = [];
9+
if ~contains(e.message, "FileNotFoundError")
10+
warning(e.identifier, "inode(%s) failed: %s", p, e.message)
11+
end
912
end
1013

1114
i = uint64(i);

+stdlib/device.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
if stdlib.has_python()
1111
i = stdlib.python.device(p);
12-
elseif isunix() && stdlib.java_api() >= 11
13-
% Java 1.8 is buggy in some corner cases, so we require at least 11.
12+
elseif isunix()
1413
i = stdlib.java.device(p);
1514
end
1615

Readme_java.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ From before Matlab R2019b to at least Matlab R2025a, the Matlab factory Java ver
4040
Java 11 or newer is recommended for more robustness if relying on Java functionality.
4141

4242
If desired (not used by Matlab-stdlib), one can use non-factory Java classes in
43-
[Matlab](](https://www.mathworks.com/help/matlab/matlab_external/static-path-of-java-class-path.html))
43+
[Matlab](https://www.mathworks.com/help/matlab/matlab_external/static-path-of-java-class-path.html))
4444
and
4545
[GNU Octave](https://docs.octave.org/interpreter/Making-Java-Classes-Available.html).
4646

@@ -81,6 +81,12 @@ Or for the Amazon Corretto JDK 11 on macOS:
8181
jenv("/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/")
8282
```
8383

84+
On Windows, obtain OpenJDK with WinGet, which installs under "$Env:ProgramFiles/Microsoft/jdk-*":
85+
86+
```sh
87+
winget install Microsoft.OpenJDK.11
88+
```
89+
8490
To
8591
[revert back to the factory JRE](https://www.mathworks.com/help/matlab/ref/matlab_jenv.html)
8692
if Matlab can't start or has problems, from system Terminal (not within Matlab):

0 commit comments

Comments
 (0)