diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java
index f4cb8ead123f62afc84d4806c825e4cbb926981c..d3dc3685831d09b175077cd041f9ec71bb906f40 100644
--- a/core/java/src/net/i2p/data/DataHelper.java
+++ b/core/java/src/net/i2p/data/DataHelper.java
@@ -480,12 +480,17 @@ public class DataHelper {
                     name.contains("=") ||
                     name.contains("\r") ||
                     name.contains("\n") ||
-                    name.startsWith(";") ||
-                    val.contains("#") ||
+                    name.startsWith(";")) {
+                    if (iae == null)
+                        iae = new IllegalArgumentException("Invalid character (one of \"#;=\\r\\n\") in key: \"" +
+                                                           name + "\" = \"" + val + '\"');
+                    continue;
+                }
+                if (val.contains("#") ||
                     val.contains("\r") ||
                     val.contains("\n")) {
                     if (iae == null)
-                        iae = new IllegalArgumentException("Invalid character (one of \"#;=\\r\\n\") in key or value: \"" +
+                        iae = new IllegalArgumentException("Invalid character (one of \"#\\r\\n\") in value: \"" +
                                                            name + "\" = \"" + val + '\"');
                     continue;
                 }