Hi all,
I'm working on an ADF Faces Rich Client atm and as some may know, that
library is based on Trinidad. Anyway, while debugging for a completely
different issue, I found out the following in SortableModel class:
private int _toRowIndex(Object rowKey)
{
if (rowKey == null)
return -1;
try
{
return ((Integer)rowKey).intValue();
}
catch (ClassCastException e)
{
_LOG.warning("INVALID_ROWKEY", new Object[]{rowKey ,
rowKey.getClass()});
_LOG.warning(e);
return -1;
}
}
I think we should change that to something like the following to not shallow
an Exception that's more expensive to create than an instanceof check. Note
that for some reason I get one such exception per request currently so this
is kind of annoying ;) :
private int _toRowIndex(Object rowKey)
{
if (rowKey == null)
{
return -1;
}
else if (rowKey instanceof Integer)
{
return ((Integer)rowKey).intValue();
}
else
{
_LOG.warning("INVALID_ROWKEY", new Object[]{rowKey ,
rowKey.getClass()});
return -1;
}
}
What do you think?
~ Simon