From 488759c66b03b41922ac1efc8c3a8edfc027cadc Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 11 May 2025 14:15:04 -0400 Subject: [PATCH] code formatting --- core/java/src/net/i2p/util/EepGet.java | 40 ++++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java index 9ea95faa7..2c5709023 100644 --- a/core/java/src/net/i2p/util/EepGet.java +++ b/core/java/src/net/i2p/util/EepGet.java @@ -387,34 +387,30 @@ public class EepGet { return name; } - -/* Blacklist borrowed from snark */ - - private static final char[] ILLEGAL = new char[] { + /** Blacklist borrowed from snark */ + private static final char[] ILLEGAL = new char[] { '<', '>', ':', '"', '/', '\\', '|', '?', '*', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0x7f }; - /** - * Removes 'suspicious' characters from the given file name. - * http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx - */ - - + /** + * Removes 'suspicious' characters from the given file name. + * http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx + */ private static String sanitize(String name) { - if (name.equals(".") || name.equals(" ")) - return "_"; - String rv = name; - if (rv.startsWith(".")) - rv = '_' + rv.substring(1); - if (rv.endsWith(".") || rv.endsWith(" ")) - rv = rv.substring(0, rv.length() - 1) + '_'; - for (int i = 0; i < ILLEGAL.length; i++) { - if (rv.indexOf(ILLEGAL[i]) >= 0) - rv = rv.replace(ILLEGAL[i], '_'); - } - return rv; + if (name.equals(".") || name.equals(" ")) + return "_"; + String rv = name; + if (rv.startsWith(".")) + rv = '_' + rv.substring(1); + if (rv.endsWith(".") || rv.endsWith(" ")) + rv = rv.substring(0, rv.length() - 1) + '_'; + for (int i = 0; i < ILLEGAL.length; i++) { + if (rv.indexOf(ILLEGAL[i]) >= 0) + rv = rv.replace(ILLEGAL[i], '_'); + } + return rv; } private static void usage() {