From: <mol...@us...> - 2009-08-25 16:16:36
|
Revision: 1312 http://openutils.svn.sourceforge.net/openutils/?rev=1312&view=rev Author: molaschi Date: 2009-08-25 16:16:27 +0000 (Tue, 25 Aug 2009) Log Message: ----------- add trim to uuid when finding a node and add url encoding for resolutions 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 2009-08-25 16:15:20 UTC (rev 1311) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2009-08-25 16:16:27 UTC (rev 1312) @@ -25,6 +25,10 @@ import info.magnolia.context.MgnlContext; import java.awt.Point; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.CharacterCodingException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -82,7 +86,7 @@ HierarchyManager hm = MgnlContext.getHierarchyManager(MediaModule.REPO); try { - return hm.getContentByUUID(uuid); + return hm.getContentByUUID(StringUtils.trim(uuid)); } catch (RepositoryException e) { @@ -125,7 +129,10 @@ { return null; } - MgnlContext.setLocale(locale); + if (locale != null) + { + MgnlContext.setLocale(locale); + } MediaTypeConfiguration mtc = mcm.getMediaTypeConfigurationFromMedia(media); if (mtc == null) { @@ -290,9 +297,9 @@ Content resolutions = media.getChildByName("resolutions"); - String resString = "res-" + resolution; try { + String resString = "res-" + URLEncoder.encode(resolution, "utf-8"); if (resolutions != null && resolutions.hasNodeData(resString)) { String resPath = new FileProperties(resolutions, resString).getProperty(FileProperties.PATH); @@ -305,6 +312,10 @@ { log.debug(e.getMessage(), e); } + catch (UnsupportedEncodingException e) + { + log.debug(e.getMessage(), e); + } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |