X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FRobustIdentifiable.java;h=640e37e13385402e9414c6beb2719bb3d6e2d378;hb=ca624324bf36e5ba8217a6af861cbf898a40adfc;hp=f3da5f401e98f0dd7ae252c8c04458c781a51ad9;hpb=e52385618670b54a5c6a4f2fbfab381bef43a905;p=xmlrouter diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustIdentifiable.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustIdentifiable.java index f3da5f4..640e37e 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustIdentifiable.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustIdentifiable.java @@ -37,15 +37,16 @@ public class RobustIdentifiable implements Identifiable { // TODO test this class. // TODO test that id is constant even though delegated changes its id. - public RobustIdentifiable(Identifiable aIdentifiable) { + public RobustIdentifiable(String aPrefix, Identifiable aIdentifiable) { // TODO test id is null // TODO getId() throws exception try { id = aIdentifiable.getId(); if (id == null) { id = new Id(Constants.UNKNOWN_ID.toString()); - throw new RuntimeException( - "Temporary to catch nulls during refactoring"); + temporarilyThrowException(); + } else { + id = new Id(aPrefix + id.getId()); } } catch (Exception e) { LOGGER @@ -54,6 +55,11 @@ public class RobustIdentifiable implements Identifiable { } + private void temporarilyThrowException() { + throw new RuntimeException( + "Temporary to catch nulls during refactoring"); + } + @Override public Id getId() { return id;