From 15e77834778fdce03521df2b304fc90f8314df9b Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 15 Nov 2008 19:00:08 +0000 Subject: [PATCH] handle missing fields in i2ptunnel edit pages better --- .../java/src/net/i2p/i2ptunnel/web/EditBean.java | 8 ++++---- .../src/net/i2p/i2ptunnel/web/IndexBean.java | 16 +++++++++++----- apps/i2ptunnel/jsp/editClient.jsp | 8 ++++++++ apps/i2ptunnel/jsp/editServer.jsp | 8 ++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java index eb7de9cf1..90e5f7e20 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java @@ -41,11 +41,11 @@ public class EditBean extends IndexBean { if (tun != null) return tun.getTargetHost(); else - return ""; + return "127.0.0.1"; } public String getTargetPort(int tunnel) { TunnelController tun = getController(tunnel); - if (tun != null) + if (tun != null && tun.getTargetPort() != null) return tun.getTargetPort(); else return ""; @@ -59,7 +59,7 @@ public class EditBean extends IndexBean { } public String getPrivateKeyFile(int tunnel) { TunnelController tun = getController(tunnel); - if (tun != null) + if (tun != null && tun.getPrivKeyFile() != null) return tun.getPrivKeyFile(); else return ""; @@ -266,4 +266,4 @@ public class EditBean extends IndexBean { } return props; } -} \ No newline at end of file +} diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java index 48d265fc2..c8d321ea2 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java @@ -96,6 +96,7 @@ public class IndexBean { _curNonce = -1; } } + public void setPassphrase(String phrase) { _passphrase = phrase; } @@ -332,15 +333,15 @@ public class IndexBean { public String getTunnelName(int tunnel) { TunnelController tun = getController(tunnel); - if (tun != null) + if (tun != null && tun.getName() != null) return tun.getName(); else - return ""; + return "New Tunnel"; } public String getClientPort(int tunnel) { TunnelController tun = getController(tunnel); - if (tun != null) + if (tun != null && tun.getListenPort() != null) return tun.getListenPort(); else return ""; @@ -389,7 +390,7 @@ public class IndexBean { public String getTunnelDescription(int tunnel) { TunnelController tun = getController(tunnel); - if (tun != null) + if (tun != null && tun.getDescription() != null) return tun.getDescription(); else return ""; @@ -406,7 +407,12 @@ public class IndexBean { public String getClientDestination(int tunnel) { TunnelController tun = getController(tunnel); if (tun == null) return ""; - if ("client".equals(tun.getType())||"ircclient".equals(tun.getType())) return tun.getTargetDestination(); + if ("client".equals(tun.getType())||"ircclient".equals(tun.getType())) { + if (tun.getTargetDestination() != null) + return tun.getTargetDestination(); + else + return ""; + } else return tun.getProxyList(); } diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsp index 47fca5385..97f8adbe5 100644 --- a/apps/i2ptunnel/jsp/editClient.jsp +++ b/apps/i2ptunnel/jsp/editClient.jsp @@ -80,6 +80,10 @@
@@ -123,6 +127,10 @@ %>
(name or destination) diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsp index 910088ce9..0cdf5e0e9 100644 --- a/apps/i2ptunnel/jsp/editServer.jsp +++ b/apps/i2ptunnel/jsp/editServer.jsp @@ -93,6 +93,10 @@
@@ -112,6 +116,10 @@ %>