Author: chris.laprun(a)jboss.com
Date: 2007-03-17 21:32:54 -0400 (Sat, 17 Mar 2007)
New Revision: 6730
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- Wrap retrieval of preferences in try-catch block... should be improved by using a
message in case an error occurs.
- Check for null on return getPortletProperties (Oracle's producer returns null).
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-18
01:30:33 UTC (rev 6729)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-18
01:32:54 UTC (rev 6730)
@@ -22,17 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-
import org.jboss.logging.Logger;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.identity.RoleModule;
@@ -48,6 +37,16 @@
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
@@ -235,7 +234,16 @@
if (portlet != null)
{
// Get preferences info
- PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
+ PreferencesInfo prefsInfo = null;
+ try
+ {
+ prefsInfo = portlet.getInfo().getPreferences();
+ }
+ catch (Exception e)
+ {
+ // todo: show a message?
+ log.info("Couldn't retrieve preferences for portlet " +
portlet.getContext().getId(), e);
+ }
// If the portlet has preferences info then we display them
if (prefsInfo != null)
@@ -275,7 +283,7 @@
List portlets = getPortlets();
// Compute upper bound
- int to = Math.min(selectedFrom + 10, portlets.size());
+ int to = Math.min(selectedFrom + paginationSize, portlets.size());
// Range
return portlets.subList(selectedFrom, to);
@@ -331,13 +339,13 @@
//
selectedPortletInvokerId = portlet.getFederatedId();
-
+
// Get sorted portlets
List portlets = new ArrayList(getSelectedPortletInvoker().getPortlets());
Collections.sort(portlets, comparator);
// Find the portlet index in the list
- for (int i = 0;i < portlets.size();i++)
+ for (int i = 0; i < portlets.size(); i++)
{
Portlet current = (Portlet)portlets.get(i);
if (portlet.getContext().getId().equals(current.getContext().getId()))
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2007-03-18
01:30:33 UTC (rev 6729)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2007-03-18
01:32:54 UTC (rev 6730)
@@ -130,28 +130,33 @@
if (prefInfo == null)
{
PortletPropertyDescriptionResponse propertyDescs =
originatingProducer.getPropertyDescriptionsFor(portletHandle);
- ModelDescription modelDesc = propertyDescs.getModelDescription();
- Map prefInfos;
- if (modelDesc != null)
+ Map prefInfos = null;
+
+ if (propertyDescs != null)
{
- PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
- if (descs != null)
+ ModelDescription modelDesc = propertyDescs.getModelDescription();
+ if (modelDesc != null)
{
- prefInfos = new HashMap(descs.length);
- for (int i = 0; i < descs.length; i++)
+ PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
+ if (descs != null)
{
- PropertyDescription desc = descs[i];
- String key = desc.getName();
- prefInfos.put(key, new WSRPPreferenceInfo(key,
createPortalLocalizedStringFrom(desc.getLabel()),
- createPortalLocalizedStringFrom(desc.getHint())));
+ prefInfos = new HashMap(descs.length);
+ for (int i = 0; i < descs.length; i++)
+ {
+ PropertyDescription desc = descs[i];
+ String key = desc.getName();
+ prefInfos.put(key, new WSRPPreferenceInfo(key,
createPortalLocalizedStringFrom(desc.getLabel()),
+ createPortalLocalizedStringFrom(desc.getHint())));
+ }
}
+ else
+ {
+ prefInfos = Collections.EMPTY_MAP;
+ }
}
- else
- {
- prefInfos = Collections.EMPTY_MAP;
- }
}
- else
+
+ if (prefInfos == null)
{
prefInfos = Collections.EMPTY_MAP;
}