From: Niki Roo Date: Fri, 5 Jul 2024 19:25:45 +0000 (+0200) Subject: old change from netbook X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=refs%2Fheads%2Fsubtree;p=nikiroo-utils.git old change from netbook --- diff --git a/LoginResult.java b/LoginResult.java index ddc148b..1e78461 100644 --- a/LoginResult.java +++ b/LoginResult.java @@ -85,6 +85,11 @@ public class LoginResult { */ public LoginResult(String cookie, String who, String key, List subkeys, boolean allowNoSubkey) { + if (who == null) + who = ""; + if (key == null) + key = ""; + if (cookie != null) { String hashes[] = cookie.split("~"); if (hashes.length >= 2) { @@ -103,6 +108,8 @@ public class LoginResult { } for (String subkey : subkeys) { + if (subkey == null) + subkey = ""; if (CookieUtils.validateCookie(wookie + subkey + opts, rehashed)) { this.cookie = generateCookie(who, key, subkey, @@ -202,10 +209,17 @@ public class LoginResult { */ private String generateCookie(String who, String key, String subkey, String option) { + if (who == null) + who = ""; + if (key == null) + key = ""; + if (subkey == null) + subkey = ""; + String wookie = CookieUtils.generateCookie(who + key, 0); - return wookie + "~" - + CookieUtils.generateCookie( - wookie + (subkey == null ? "" : subkey) + option, 0) - + "~" + option; + return wookie + "~" // + + CookieUtils.generateCookie(wookie + subkey + option, 0) // + + "~" // + + option; } } \ No newline at end of file