Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit ea997b6

Browse files
committed
Fix type conversion for more complex methods
1 parent 582a6f3 commit ea997b6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/main/java/org/purejava/kwallet/KDEWallet.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class KDEWallet extends Messaging implements KWallet, AutoCloseable {
2222
private static final Logger LOG = LoggerFactory.getLogger(KDEWallet.class);
2323
private static String SERVICE;
2424
private static String OBJECT_PATHS;
25-
private DBusConnection connection;
25+
private final DBusConnection connection;
2626

2727
public static final List<Class<? extends DBusSignal>> SIGNALS = Arrays.asList(
2828
applicationDisconnected.class,
@@ -230,14 +230,24 @@ public String readPassword(int handle, String folder, String key, String appid)
230230
public Map<String, byte[]> entriesList(int handle, String folder, String appid) {
231231
var map = contentOrEmptyMap(send("entriesList", "iss", handle, folder, appid));
232232
return map.entrySet().stream()
233-
.collect(Collectors.toMap(Map.Entry::getKey, e -> (byte[]) e.getValue().getValue()));
233+
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
234+
var objectList = (List<?>) e.getValue().getValue();
235+
var innerMap = new byte[objectList.size()];
236+
IntStream.range(0, objectList.size()).forEach(i -> innerMap[i] = (Byte) objectList.get(i));
237+
return innerMap;
238+
}));
234239
}
235240

236241
@Override
237242
public Map<String, byte[]> mapList(int handle, String folder, String appid) {
238243
var map = contentOrEmptyMap(send("mapList", "iss", handle, folder, appid));
239244
return map.entrySet().stream()
240-
.collect(Collectors.toMap(Map.Entry::getKey, e -> (byte[]) e.getValue().getValue()));
245+
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
246+
var objectList = (List<?>) e.getValue().getValue();
247+
var innerMap = new byte[objectList.size()];
248+
IntStream.range(0, objectList.size()).forEach(i -> innerMap[i] = (Byte) objectList.get(i));
249+
return innerMap;
250+
}));
241251
}
242252

243253
@Override

0 commit comments

Comments
 (0)