From 91cdf8577294ebb84c4b390a3db50b8567eb6448 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 20 Feb 2014 14:08:05 +0000
Subject: [PATCH]  * Router: Allow null args to main() (broke Android)

---
 history.txt                                   |  4 ++
 router/java/src/net/i2p/router/Router.java    | 38 ++++++++++---------
 .../java/src/net/i2p/router/RouterLaunch.java |  2 +-
 .../src/net/i2p/router/RouterVersion.java     |  2 +-
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/history.txt b/history.txt
index 64a8cb9114..2b77c35371 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,7 @@
+2014-02-20 zzz
+ * i2ptunnel: Add inproxy block option to HTTP server
+ * Router: Allow null args to main() (broke Android)
+
 2014-02-17 zzz
  * HMAC:
    - Replace BC MD5 with JVM version, refactor I2PHMAC to use
diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java
index 04dae1e8f7..600c35f718 100644
--- a/router/java/src/net/i2p/router/Router.java
+++ b/router/java/src/net/i2p/router/Router.java
@@ -1109,30 +1109,32 @@ public class Router implements RouterClock.ClockShiftListener {
      *  Usage: Router [rebuild]
      *  No other options allowed, for now
      *
-     *  @param args non-null
+     *  @param args null ok
      *  @throws IllegalArgumentException
      */
     public static void main(String args[]) {
-        boolean error = false;
-        Getopt g = new Getopt("router", args, "");
-        int c;
-        while ((c = g.getopt()) != -1) {
-            switch (c) {
-                default:
-                    error = true;
-            }
-        }
         boolean rebuild = false;
-        int remaining = args.length - g.getOptind();
-        if (remaining > 1) {
-            error = true;
-        } else if (remaining == 1) {
-            rebuild = args[g.getOptind()].equals("rebuild");;
-            if (!rebuild)
+        if (args != null) {
+            boolean error = false;
+            Getopt g = new Getopt("router", args, "");
+            int c;
+            while ((c = g.getopt()) != -1) {
+                switch (c) {
+                    default:
+                        error = true;
+                }
+            }
+            int remaining = args.length - g.getOptind();
+            if (remaining > 1) {
                 error = true;
+            } else if (remaining == 1) {
+                rebuild = args[g.getOptind()].equals("rebuild");;
+                if (!rebuild)
+                    error = true;
+            }
+            if (error)
+                throw new IllegalArgumentException();
         }
-        if (error)
-            throw new IllegalArgumentException();
 
         System.out.println("Starting I2P " + RouterVersion.FULL_VERSION);
         //verifyWrapperConfig();
diff --git a/router/java/src/net/i2p/router/RouterLaunch.java b/router/java/src/net/i2p/router/RouterLaunch.java
index 5ebe0e16b0..f1fcbc09ea 100644
--- a/router/java/src/net/i2p/router/RouterLaunch.java
+++ b/router/java/src/net/i2p/router/RouterLaunch.java
@@ -14,7 +14,7 @@ public class RouterLaunch {
      *  Usage: RouterLaunch [rebuild]
      *  No other options allowed, for now
      *
-     *  @param args non-null
+     *  @param args null ok
      *  @throws IllegalArgumentException
      */
     public static void main(String args[]) {
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index f2522cd4ed..7ca1a3ec2c 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -18,7 +18,7 @@ public class RouterVersion {
     /** deprecated */
     public final static String ID = "Monotone";
     public final static String VERSION = CoreVersion.VERSION;
-    public final static long BUILD = 9;
+    public final static long BUILD = 10;
 
     /** for example "-test" */
     public final static String EXTRA = "";
-- 
GitLab