mirror of
https://github.com/kaboomserver/extras.git
synced 2025-07-24 06:23:46 +00:00
Fix behavior when OSHI can't run (#379)
* Fix fallback behavior * Catch class load errors
This commit is contained in:
parent
f6baa88cd0
commit
a06a8e9cea
2 changed files with 6 additions and 4 deletions
|
@ -17,7 +17,7 @@ import java.lang.management.ManagementFactory;
|
|||
import java.net.InetAddress;
|
||||
|
||||
public final class CommandServerInfo implements CommandExecutor {
|
||||
private static final @Nullable String[] GPU_DEVICES;
|
||||
private static final String[] GPU_DEVICES;
|
||||
private static final @Nullable String PROCESSOR_NAME;
|
||||
|
||||
static {
|
||||
|
@ -48,7 +48,7 @@ public final class CommandServerInfo implements CommandExecutor {
|
|||
);
|
||||
|
||||
if (hardwareInfo == null) {
|
||||
GPU_DEVICES = null;
|
||||
GPU_DEVICES = new String[0];
|
||||
PROCESSOR_NAME = null;
|
||||
} else {
|
||||
GPU_DEVICES = hardwareInfo.first();
|
||||
|
@ -95,7 +95,9 @@ public final class CommandServerInfo implements CommandExecutor {
|
|||
+ ManagementFactory.getRuntimeMXBean().getVmVersion()
|
||||
);
|
||||
|
||||
sendInfoMessage(sender, "CPU model", PROCESSOR_NAME);
|
||||
if (PROCESSOR_NAME != null) {
|
||||
sendInfoMessage(sender, "CPU model", PROCESSOR_NAME);
|
||||
}
|
||||
|
||||
sendInfoMessage(sender, "CPU cores",
|
||||
String.valueOf(Runtime.getRuntime().availableProcessors())
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class Utility {
|
|||
) {
|
||||
try {
|
||||
return composer.apply(callable.call());
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue