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

@ -149,7 +149,7 @@ public class Coll<E> implements CollInterface<E>
if (oid == null) return null; if (oid == null) return null;
String ret = null; String ret = null;
if (oid instanceof String) if (oid instanceof String)
{ {
ret = (String)oid; ret = (String)oid;
} }

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;
if (oid instanceof String) String ret = null;
if (oid instanceof String)
{ {
String ret = (String)oid; ret = (String)oid;
return this.isLowercasing() ? ret.toLowerCase() : ret; }
else if (oid.getClass() == this.entityClass)
{
ret = this.entity2id.get(oid);
} }
if (oid.getClass() == this.entityClass) if (ret == null)
{ {
return fixId(this.entity2id.get(oid)); ret = IdUtil.getId(oid);
} }
return fixId(IdUtil.getId(oid)); if (ret == null)
{
return null;
}
if (this.isLowercasing())
{
ret = ret.toLowerCase();
}
return ret;
} }
// -------------------------------------------- // // -------------------------------------------- //