X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNode.java;h=3d35b4727189f31fd7ed94e06423880ea5725fba;hb=c63257e8cc0ba1a5aca9364b22171abe7279d479;hp=b632eea859ef3e6ceaee76f1d75ccde567dfbe28;hpb=164c7174571672ca255b918a56c8db9336e31d19;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/Node.java b/src/net/pterodactylus/jsite/core/Node.java index b632eea..3d35b47 100644 --- a/src/net/pterodactylus/jsite/core/Node.java +++ b/src/net/pterodactylus/jsite/core/Node.java @@ -28,7 +28,7 @@ import net.pterodactylus.util.number.Hex; /** * Container for a Freenet node. A Node is capable of notifying * {@link PropertyChangeListener}s if any of the contained properties change. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class Node extends AbstractBean { @@ -63,7 +63,7 @@ public class Node extends AbstractBean { /** * Returns the internal ID of the node. - * + * * @return The internal ID of the node */ String getId() { @@ -72,17 +72,21 @@ public class Node extends AbstractBean { /** * Sets the internal ID of the node. - * + * * @param id * The internal ID of the node */ void setId(String id) { - this.id = id; + if (id == null) { + this.id = Hex.toHex(IdGenerator.generateId()); + } else { + this.id = id; + } } /** * Returns the user-given name of the node. - * + * * @return The name of the node */ public String getName() { @@ -91,7 +95,7 @@ public class Node extends AbstractBean { /** * Sets the user-given name of the node. - * + * * @param name * The name of the node */ @@ -103,7 +107,7 @@ public class Node extends AbstractBean { /** * Returns the hostname of the node. - * + * * @return The hostname of the node */ public String getHostname() { @@ -112,7 +116,7 @@ public class Node extends AbstractBean { /** * Sets the hostname of the node. - * + * * @param hostname * The hostname of the node */ @@ -124,7 +128,7 @@ public class Node extends AbstractBean { /** * Returns the port number of the node. - * + * * @return The port number of the node */ public int getPort() { @@ -133,7 +137,7 @@ public class Node extends AbstractBean { /** * Sets the port number of the node. - * + * * @param port * The port number of the node */