From: <fg...@us...> - 2010-02-13 18:32:20
|
Revision: 1912 http://openutils.svn.sourceforge.net/openutils/?rev=1912&view=rev Author: fgiust Date: 2010-02-13 18:32:14 +0000 (Sat, 13 Feb 2010) Log Message: ----------- MEDIA-90 nodedata.getAttribute() called for non-binary nodedata, will be a problem with magnolia 4.3 Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2010-02-13 14:14:38 UTC (rev 1911) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2010-02-13 18:32:14 UTC (rev 1912) @@ -35,6 +35,7 @@ import java.util.Map; import javax.jcr.ItemNotFoundException; +import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.query.InvalidQueryException; @@ -325,13 +326,18 @@ */ public static String getResolutionUrl(Content media, String resolution) { - FileProperties prop = new FileProperties(media, BaseTypeHandler.ORGINAL_NODEDATA_NAME); - Integer width = NumberUtils.toInt(prop.getProperty(FileProperties.PROPERTY_WIDTH)); - Integer height = NumberUtils.toInt(prop.getProperty(FileProperties.PROPERTY_HEIGHT)); - Point size = ImageUtils.parseForSize(resolution); - if (width == size.x && height == size.y) + + // MEDIA-90 may be simply a url + if (media.getNodeData(BaseTypeHandler.ORGINAL_NODEDATA_NAME).getType() == PropertyType.BINARY) { - return mcm.getURIMappingPrefix() + prop.getProperty(FileProperties.PATH); + FileProperties prop = new FileProperties(media, BaseTypeHandler.ORGINAL_NODEDATA_NAME); + Integer width = NumberUtils.toInt(prop.getProperty(FileProperties.PROPERTY_WIDTH)); + Integer height = NumberUtils.toInt(prop.getProperty(FileProperties.PROPERTY_HEIGHT)); + Point size = ImageUtils.parseForSize(resolution); + if (width == size.x && height == size.y) + { + return mcm.getURIMappingPrefix() + prop.getProperty(FileProperties.PATH); + } } if (media == null || !ImageUtils.checkOrCreateResolution(media, resolution, null)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |