{
return null;
}
try
{
final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
final Resource resource = resManager.createDirectly(url, DrawableWrapper.class);
return resource.getResource();
}
catch (ResourceException e)
{
if (DrawableLoadFilter.logger.isDebugEnabled())
{
DrawableLoadFilter.logger.debug("Error while loading the drawable from " + url, e);
}
else if (DrawableLoadFilter.logger.isWarnEnabled())
{
DrawableLoadFilter.logger.warn("Error while loading the drawable from " + url + ": " + e.getMessage());
}
failureCache.add(urlString);
return null;
}
}
else if (o instanceof byte[])
{
try
{
final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
final Resource resource = resManager.createDirectly(o, DrawableWrapper.class);
return resource.getResource();
}
catch (ResourceException e)
{
if (DrawableLoadFilter.logger.isDebugEnabled())
{
DrawableLoadFilter.logger.debug("Error while loading the drawable from byte[]", e);
}
else if (DrawableLoadFilter.logger.isWarnEnabled())
{
DrawableLoadFilter.logger.warn("Error while loading the drawable from byte[]: " + e.getMessage());
}
return null;
}
}
else if (o instanceof Blob)
{
try
{
final Blob b = (Blob) o;
final byte[] data = b.getBytes(1, (int) b.length());
final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
final Resource resource = resManager.createDirectly(data, DrawableWrapper.class);
return resource.getResource();
}
catch (Exception e)
{
if (DrawableLoadFilter.logger.isDebugEnabled())