You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2014/10/30 12:01:13 UTC

svn commit: r1635465 - /ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java

Author: adrianc
Date: Thu Oct 30 11:01:13 2014
New Revision: 1635465

URL: http://svn.apache.org/r1635465
Log:
Fix ClassCastException.

Modified:
    ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java

Modified: ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=1635465&r1=1635464&r2=1635465&view=diff
==============================================================================
--- ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (original)
+++ ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Thu Oct 30 11:01:13 2014
@@ -20,6 +20,7 @@ package org.ofbiz.widget.screen;
 
 import java.io.IOException;
 import java.io.Writer;
+import java.util.List;
 import java.util.Map;
 
 import javax.servlet.ServletContext;
@@ -76,22 +77,34 @@ public class MacroScreenViewHandler exte
                 serviceCtx.put("visualThemeId", visualThemeId);
                 Map<String, Object> serviceResult = dispatcher.runSync("getVisualThemeResources", serviceCtx);
                 if (ServiceUtil.isSuccess(serviceResult)) {
-                    Map<String, Object> themeResources = UtilGenerics.cast(serviceResult.get("themeResources"));
-                    String macroLibraryPath = (String) themeResources.get("VT_SCRN_MACRO_LIB");
-                    if (macroLibraryPath != null) {
-                        screenMacroLibraryPath = macroLibraryPath;
+                    Map<String, List<String>> themeResources = UtilGenerics.cast(serviceResult.get("themeResources"));
+                    List<String> resourceList = UtilGenerics.cast(themeResources.get("VT_SCRN_MACRO_LIB"));
+                    if (resourceList != null && !resourceList.isEmpty()) {
+                        String macroLibraryPath = resourceList.get(0);
+                        if (macroLibraryPath != null) {
+                            screenMacroLibraryPath = macroLibraryPath;
+                        }
                     }
-                    macroLibraryPath = (String) themeResources.get("VT_FORM_MACRO_LIB");
-                    if (macroLibraryPath != null) {
-                        formMacroLibraryPath = macroLibraryPath;
+                    resourceList = UtilGenerics.cast(themeResources.get("VT_FORM_MACRO_LIB"));
+                    if (resourceList != null && !resourceList.isEmpty()) {
+                        String macroLibraryPath = resourceList.get(0);
+                        if (macroLibraryPath != null) {
+                            formMacroLibraryPath = macroLibraryPath;
+                        }
                     }
-                    macroLibraryPath = (String) themeResources.get("VT_TREE_MACRO_LIB");
-                    if (macroLibraryPath != null) {
-                        treeMacroLibraryPath = macroLibraryPath;
+                    resourceList = UtilGenerics.cast(themeResources.get("VT_TREE_MACRO_LIB"));
+                    if (resourceList != null && !resourceList.isEmpty()) {
+                        String macroLibraryPath = resourceList.get(0);
+                        if (macroLibraryPath != null) {
+                            treeMacroLibraryPath = macroLibraryPath;
+                        }
                     }
-                    macroLibraryPath = (String) themeResources.get("VT_MENU_MACRO_LIB");
-                    if (macroLibraryPath != null) {
-                        menuMacroLibraryPath = macroLibraryPath;
+                    resourceList = UtilGenerics.cast(themeResources.get("VT_MENU_MACRO_LIB"));
+                    if (resourceList != null && !resourceList.isEmpty()) {
+                        String macroLibraryPath = resourceList.get(0);
+                        if (macroLibraryPath != null) {
+                            menuMacroLibraryPath = macroLibraryPath;
+                        }
                     }
                 }
             }