handle missing fields in i2ptunnel edit pages better
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,10 @@
|
||||
<div id="portField" class="rowItem">
|
||||
<label for="port" accesskey="P">
|
||||
<span class="accessKey">P</span>ort:
|
||||
<% String value = editBean.getClientPort(curTunnel);
|
||||
if (value == null || "".equals(value.trim()))
|
||||
out.write(" <font color=\"red\">(required)</font>");
|
||||
%>
|
||||
</label>
|
||||
<input type="text" size="6" maxlength="5" id="port" name="port" title="Access Port Number" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
@ -123,6 +127,10 @@
|
||||
%><div id="destinationField" class="rowItem">
|
||||
<label for="targetDestination" accesskey="T">
|
||||
<span class="accessKey">T</span>unnel Destination:
|
||||
<% String value2 = editBean.getClientDestination(curTunnel);
|
||||
if (value2 == null || "".equals(value2.trim()))
|
||||
out.write(" <font color=\"red\">(required)</font>");
|
||||
%>
|
||||
</label>
|
||||
<input type="text" size="30" id="targetDestination" name="targetDestination" title="Destination of the Tunnel" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext" />
|
||||
<span class="comment">(name or destination)</span>
|
||||
|
@ -93,6 +93,10 @@
|
||||
<div id="portField" class="rowItem">
|
||||
<label for="targetPort" accesskey="P">
|
||||
<span class="accessKey">P</span>ort:
|
||||
<% String value = editBean.getTargetPort(curTunnel);
|
||||
if (value == null || "".equals(value.trim()))
|
||||
out.write(" <font color=\"red\">(required)</font>");
|
||||
%>
|
||||
</label>
|
||||
<input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="Target Port Number" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
@ -112,6 +116,10 @@
|
||||
%><div id="privKeyField" class="rowItem">
|
||||
<label for="privKeyFile" accesskey="k">
|
||||
Private <span class="accessKey">k</span>ey file:
|
||||
<% String value2 = editBean.getPrivateKeyFile(curTunnel);
|
||||
if (value2 == null || "".equals(value2.trim()))
|
||||
out.write(" <font color=\"red\">(required)</font>");
|
||||
%>
|
||||
</label>
|
||||
<input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user