create new id if null id is set
[jSite2.git] / src / net / pterodactylus / jsite / core / Node.java
index b632eea..9a4d3be 100644 (file)
@@ -77,7 +77,11 @@ public class Node extends AbstractBean {
         *            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;
+               }
        }
 
        /**