summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-25 14:19:47 +0200
committerSimon Rettberg2022-05-25 14:19:47 +0200
commit4b271c1a9e2216dec88fa36924e906ac3ea85fc5 (patch)
tree77f2abaac72aa792a4e5bf628ccb550764be2424 /src
parent[WakeOnLan] Implement password usage as it's actually required :> (diff)
downloadtmlite-bwlp-4b271c1a9e2216dec88fa36924e906ac3ea85fc5.tar.gz
tmlite-bwlp-4b271c1a9e2216dec88fa36924e906ac3ea85fc5.tar.xz
tmlite-bwlp-4b271c1a9e2216dec88fa36924e906ac3ea85fc5.zip
[WakeOnLan] Fix breakage with empty passwords
Java helpfully discards trailing empty elements in String.split(), which unfortunately was not what we wanted here.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
index c03740a..bd9693c 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
@@ -88,7 +88,8 @@ public class WakeOnLan extends AbstractTask
if ( client.methods.isEmpty() )
continue;
// Group by method and destination IP address
- String method = client.methods.remove( 0 ) + "//" + client.ip + "//" + ( client.password == null ? "" : client.password );
+ String method = client.methods.remove( 0 ) + "//" + client.ip
+ + "//" + ( client.password == null ? "" : client.password );
ArrayList<String> list = byMethod.get( method );
if ( list == null ) {
list = new ArrayList<>();
@@ -107,7 +108,7 @@ public class WakeOnLan extends AbstractTask
final List<String> macs = it.getValue();
final String macString = Strings.join( macs.iterator(), ' ' );
final String broadcastIp = parts[1];
- final String password = parts[2];
+ final String password = parts.length >= 3 ? parts[2] : "";
final int jobId = ++jobIdCounter;
if ( method.equalsIgnoreCase( "DIRECT" ) ) {
// Directly from server