Console: Fix NPE on /configsidebar (ticket #2220)

Don't throw NPE translating null
Add note about split()
Fix form inside table
This commit is contained in:
zzz
2018-04-29 20:57:47 +00:00
parent c73b5b9edb
commit 8ed1b96f3a
6 changed files with 33 additions and 7 deletions

View File

@ -1950,6 +1950,9 @@ public class DataHelper {
* Same as s.split(regex) but caches the compiled pattern for speed.
* This saves about 10 microseconds (Bulldozer) on subsequent invocations.
*
* Note: For an input "" this returns [""], not a zero-length array.
* This is the same behavior as String.split().
*
* @param s non-null
* @param regex non-null, don't forget to enclose multiple choices with []
* @throws java.util.regex.PatternSyntaxException unchecked
@ -1965,6 +1968,9 @@ public class DataHelper {
* Same as s.split(regex, limit) but caches the compiled pattern for speed.
* This saves about 10 microseconds (Bulldozer) on subsequent invocations.
*
* Note: For an input "" this returns [""], not a zero-length array.
* This is the same behavior as String.split().
*
* @param s non-null
* @param regex non-null, don't forget to enclose multiple choices with []
* @param limit result threshold

View File

@ -43,6 +43,10 @@ public abstract class Translate {
/** lang in routerconsole.lang property, else current locale */
public static String getString(String key, I2PAppContext ctx, String bun) {
if (key == null) {
(new NullPointerException("null translation string")).printStackTrace();
return "";
}
String lang = getLanguage(ctx);
if (lang.equals("en"))
return key;