The SenderEntity fixId does not have do be recursive.

This commit is contained in:
Olof Larsson 2014-10-03 11:23:25 +02:00
parent 8b45d2b71e
commit 04f03eb14a
2 changed files with 23 additions and 7 deletions

View File

@ -41,20 +41,36 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
@Override @Override
public String fixId(Object oid) public String fixId(Object oid)
{ {
// A null oid should always return null.
if (oid == null) return null; if (oid == null) return null;
String ret = null;
if (oid instanceof String) if (oid instanceof String)
{ {
String ret = (String)oid; ret = (String)oid;
return this.isLowercasing() ? ret.toLowerCase() : ret;
} }
else if (oid.getClass() == this.entityClass)
if (oid.getClass() == this.entityClass)
{ {
return fixId(this.entity2id.get(oid)); ret = this.entity2id.get(oid);
} }
return fixId(IdUtil.getId(oid)); if (ret == null)
{
ret = IdUtil.getId(oid);
}
if (ret == null)
{
return null;
}
if (this.isLowercasing())
{
ret = ret.toLowerCase();
}
return ret;
} }
// -------------------------------------------- // // -------------------------------------------- //