if (obj instanceof Short || obj instanceof Byte)
return ((Number) obj).shortValue();
else if (obj == null || obj instanceof String)
return (short) Long.parseLong((String) obj);
else
throw new MessageFormatException(L.l("can't convert '{0}' to short",
obj.getClass().getName()));
}