i2ptunnel: Fix duplicate tunnels on create

Fix null tunnel name
Javadoc fixes
This commit is contained in:
zzz
2018-01-26 14:28:41 +00:00
parent c098e5602d
commit 276d1c907e
4 changed files with 18 additions and 8 deletions

View File

@@ -98,7 +98,8 @@ public class GeneralHelper {
boolean created = SSLClientUtil.verifyKeyStore(props, OPT);
if (created) {
// config now contains new keystore props
msgs.add("Created new self-signed certificate for tunnel " + getTunnelName(tcg, tunnel));
String name = props.getProperty(TunnelController.PROP_NAME, "");
msgs.add("Created new self-signed certificate for tunnel " + name);
}
} catch (IOException ioe) {
msgs.add("Failed to create new self-signed certificate for tunnel " +
@@ -225,9 +226,16 @@ public class GeneralHelper {
return (tun != null && tun.getType() != null) ? tun.getType() : "";
}
/**
* @return null if unset
*/
public String getTunnelName(int tunnel) {
return getTunnelName(_group, tunnel);
}
/**
* @return null if unset
*/
public static String getTunnelName(TunnelControllerGroup tcg, int tunnel) {
TunnelController tun = getController(tcg, tunnel);
return tun != null ? tun.getName() : null;

View File

@@ -283,6 +283,8 @@ public class IndexBean {
* Executes any action requested (start/stop/etc) and dump out the
* messages.
*
* Only call this ONCE! Or you will get duplicate tunnels on save.
*
* @return HTML escaped or "" if empty
*/
public String getMessages() {
@@ -363,7 +365,7 @@ public class IndexBean {
public String getTunnelName(int tunnel) {
String name = _helper.getTunnelName(tunnel);
if (name != null)
if (name != null && name.length() > 0)
return DataHelper.escapeHTML(name);
else
return _t("New Tunnel");
@@ -666,7 +668,7 @@ public class IndexBean {
}
}
/** how many hops to use for inbound tunnels
/** how many hops to use for outbound tunnels
* @since 0.9.33
*/
public void setTunnelDepthOut(String tunnelDepth) {
@@ -677,7 +679,7 @@ public class IndexBean {
}
}
/** how many parallel inbound tunnels to use
/** how many parallel outbound tunnels to use
* @since 0.9.33
*/
public void setTunnelQuantityOut(String tunnelQuantity) {
@@ -688,7 +690,7 @@ public class IndexBean {
}
}
/** how much randomisation to apply to the depth of tunnels
/** how much randomisation to apply to the depth of outbound tunnels
* @since 0.9.33
*/
public void setTunnelVarianceOut(String tunnelVariance) {
@@ -699,7 +701,7 @@ public class IndexBean {
}
}
/** how many tunnels to hold in reserve to guard against failures
/** how many outbound tunnels to hold in reserve to guard against failures
* @since 0.9.33
*/
public void setTunnelBackupQuantityOut(String tunnelBackupQuantity) {

View File

@@ -48,7 +48,7 @@
<table id="statusMessagesTable">
<tr>
<td id="tunnelMessages">
<textarea id="statusMessages" rows="4" cols="60" readonly="readonly"><jsp:getProperty name="indexBean" property="messages" /></textarea>
<textarea id="statusMessages" rows="4" cols="60" readonly="readonly"><%=msgs%></textarea>
</td>
</tr>
<tr>

View File

@@ -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 = 26;
public final static long BUILD = 27;
/** for example "-test" */
public final static String EXTRA = "-rc";