git://source.jalview.org
/
vamsas.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tidier file locks - lock file is removed on JVM exit.
[vamsas.git]
/
src
/
org
/
vamsas
/
client
/
simpleclient
/
IdFactory.java
diff --git
a/src/org/vamsas/client/simpleclient/IdFactory.java
b/src/org/vamsas/client/simpleclient/IdFactory.java
index
80f8f28
..
dafd08e
100644
(file)
--- a/
src/org/vamsas/client/simpleclient/IdFactory.java
+++ b/
src/org/vamsas/client/simpleclient/IdFactory.java
@@
-66,6
+66,10
@@
public class IdFactory extends VorbaIdFactory {
public VorbaId makeVorbaId(Vobject vobject) {
if (session==null)
throw new Error("makeVorbaId called on improperly initialised IdFactory Vobject!");
public VorbaId makeVorbaId(Vobject vobject) {
if (session==null)
throw new Error("makeVorbaId called on improperly initialised IdFactory Vobject!");
+ if (!vobject.isRegisterable())
+ throw new Error("makeVorbaId called on unregisterable object.");
+ if (vobject.isRegistered())
+ throw new Error("makeVorbaId called on already registered object.");
String newidstring;
do {
if (sequence>0) {
String newidstring;
do {
if (sequence>0) {
@@
-77,7
+81,7
@@
public class IdFactory extends VorbaIdFactory {
newidstring=idstring+Integer.toString(sequence);
} while (extantids.containsKey(newidstring));
extantids.put(newidstring, vobject); // hash the Vobject by its new Id
newidstring=idstring+Integer.toString(sequence);
} while (extantids.containsKey(newidstring));
extantids.put(newidstring, vobject); // hash the Vobject by its new Id
- VorbaId id = newId(newidstring);
+ VorbaId id = newId(newidstring); // VorbaId.hash()==newidstring.hash() so we can still recover vobject
return id;
}
return id;
}