portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r771261 [1/2] - in /portals/jetspeed-2/applications/j2-admin/trunk/src: main/java/org/apache/jetspeed/portlets/localeselector/ main/java/org/apache/jetspeed/portlets/palm/ main/java/org/apache/jetspeed/portlets/prm/ main/java/org/apache/jet...
Date Mon, 04 May 2009 10:18:38 GMT
Author: woonsan
Date: Mon May  4 10:18:30 2009
New Revision: 771261

URL: http://svn.apache.org/viewvc?rev=771261&view=rev
Log:
JS2-946: Fixing portlet default preferences managment.
Also, in j2-admin, replaces all 'printStackTrace()' or 'System.[out|err].println()' statements with 'logger.error()'.

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java   (with props)
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/profiler/WicketProfilerAdmin.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/SecurityUtil.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/GroupChooserPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/RoleChooserPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/UserChooserPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/constraints/ConstraintsViewController.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSODetails.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/PortletSelector.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/serializer/PortalDataSerializer.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOTicketPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/DynamicResourceLink.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java Mon May  4 10:18:30 2009
@@ -38,6 +38,8 @@
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.util.JetspeedLocale;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This is the portlet to select user's preferred locale.
@@ -48,6 +50,8 @@
 public class LocaleSelectorPortlet extends GenericPortlet
 {
     public static final String PREFERED_LOCALE_SESSION_KEY = "prefered_locale";
+    
+    static final Logger logger = LoggerFactory.getLogger(LocaleSelectorPortlet.class);
 
     private UserManager userManager;
     
@@ -121,14 +125,13 @@
                 {
                     User user = userManager.getUser(request.getRemoteUser());
                     // TODO if preferred lang or locale is defined in PLT.D, it's better to use it
-                   SecurityAttributes secAttrs = user.getSecurityAttributes();
-                   secAttrs.getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, true).setStringValue(JetspeedLocale.convertLocaleToString(preferedLocale));
-                   userManager.updateUser(user);
+                    SecurityAttributes secAttrs = user.getSecurityAttributes();
+                    secAttrs.getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, true).setStringValue(JetspeedLocale.convertLocaleToString(preferedLocale));
+                    userManager.updateUser(user);
                 }
                 catch (SecurityException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to update security attributes with preferred locale.", e);
                 }
             }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java Mon May  4 10:18:30 2009
@@ -41,6 +41,8 @@
 import org.apache.portals.bridges.common.GenericServletPortlet;
 import org.apache.portals.gems.util.StatusMessage;
 import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * PALM Portlet
@@ -50,6 +52,8 @@
  */
 public class PortletApplicationLifecycleManager extends GenericServletPortlet
 {
+    static final Logger logger = LoggerFactory.getLogger(PortletApplicationLifecycleManager.class);
+    
     private ApplicationServerManager asm;
     private PortletRegistry          registry;
     private PortletFactory           portletFactory;
@@ -167,7 +171,7 @@
         }
         catch (Exception ee)
         {
-            System.err.println("Failed to publish message: " + message);
+            logger.error("Failed to publish message: {}", message);
         }        
     }
 
@@ -193,7 +197,7 @@
             }
             catch (Exception e)
             {
-                e.printStackTrace();
+                logger.error("Failed to start application: " + pa.getContextPath(), e);
                 publishStatusMessage(request, "PAM", "status", e, "Could not start Portlet Application "+pa.getName());
             }
         }
@@ -221,7 +225,7 @@
             }
             catch (Exception e)
             {
-                e.printStackTrace();
+                logger.error("Failed to stop application: " + pa.getContextPath(), e);
                 publishStatusMessage(request, "PALM", "status", e, "Could not stop Portlet Application "+pa.getName());
             }
         }
@@ -245,7 +249,7 @@
             }
             catch (Exception e)
             {
-                e.printStackTrace();
+                logger.error("Failed to undeploy application: " + pa.getContextPath(), e);
                 publishStatusMessage(request, "PALM", "status", e, "Could not undeploy Portlet Application "+pa.getName());
             }
         }
@@ -265,7 +269,7 @@
             }
             catch (RegistryException e)
             {
-                e.printStackTrace();
+                logger.error("Failed to remove application: " + pa.getContextPath(), e);
                 publishStatusMessage(request, "PALM", "status", e, "Could not delete Portlet Application "+pa.getName());
             }
         }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java Mon May  4 10:18:30 2009
@@ -49,6 +49,8 @@
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * View Mode for Portlet Application List widget
@@ -60,6 +62,8 @@
 {
     private static final String APP_TABLE = "appTable";
     private static final String PORTLET_TABLE = "portletTable";
+    
+    static final Logger logger = LoggerFactory.getLogger(ApplicationsListHome.class);
 
     public static final String PORTLET_REGISTRY_MANAGER = "Portlet Registry Manager";
 
@@ -102,8 +106,7 @@
                         }
                         catch (NotSerializableException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            logger.error("Message to publish is not serializable.", e);
                         }
                     }
                 };
@@ -208,8 +211,7 @@
                         } 
                         catch (NotSerializableException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            logger.error("Message to publish is not serializable.", e);
                         }
                     }
                 };

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java Mon May  4 10:18:30 2009
@@ -35,10 +35,14 @@
 import org.apache.wicket.markup.html.panel.Fragment;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MetadataPanel extends EditorTemplate<LocalizedFieldBean>
 {
     private static final long serialVersionUID = 1L;
+    
+    static final Logger logger = LoggerFactory.getLogger(MetadataPanel.class);
 
     private PortletApplicationNodeBean paNodeBean;
     private String newName, newValue, newLocale;
@@ -95,8 +99,7 @@
                 }
                 catch (RegistryException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Exception occurred during updating portlet application or saving portlet definition.", e);
                 }
             }
         };
@@ -166,8 +169,7 @@
         }
         catch (RegistryException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Exception occurred during updating portlet application or saving portlet definition.", e);
         }
     }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java Mon May  4 10:18:30 2009
@@ -41,11 +41,15 @@
 import org.apache.wicket.markup.repeater.data.ListDataProvider;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class UserAttributePanel extends EditorTemplate<UserAttributeBean>
 {
     private static final long serialVersionUID = 1L;
     
+    static final Logger logger = LoggerFactory.getLogger(UserAttributePanel.class);
+    
     private PortletApplicationNodeBean paNodeBean;
     private String newName, newLocale, newDescription;
 
@@ -112,7 +116,6 @@
                             
                             if (newLocale != null && newDescription != null)
                             {
-                                // We need to retrieve user attribute each time because portlet application can be refreshed any time.
                                 UserAttribute attr = app.getUserAttribute(userAttr.getName());
                                 Locale locale = new Locale(newLocale);
                                 Description targetDescription = null;
@@ -141,8 +144,7 @@
                         }
                         catch (RegistryException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            logger.error("Failed to update portlet application.", e);
                         }
                     }
                 };
@@ -178,8 +180,7 @@
                 }
                 catch (RegistryException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to update portlet application.", e);
                 }
             }
         });
@@ -212,8 +213,7 @@
         }
         catch (RegistryException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Failed to update portlet application.", e);
         }
     }
 
@@ -266,8 +266,7 @@
                 }
                 catch (RegistryException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to update portlet application", e);
                 }
             }
         };

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java?rev=771261&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java Mon May  4 10:18:30 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm.model;
+
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.Preference;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class PreferenceModel extends LoadableDetachableModel<Preference>
+{
+    
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private String name;
+
+    public PreferenceModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, Preference preference)
+    {
+        super(preference);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.name = preference.getName();
+    }
+    
+    @Override
+    protected Preference load()
+    {
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        Preference preference = (Preference) def.getPortletPreferences().getPortletPreference(name);
+        return preference;
+    }
+    
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PreferenceModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java Mon May  4 10:18:30 2009
@@ -43,11 +43,15 @@
 import org.apache.wicket.markup.repeater.data.ListDataProvider;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ParameterPanel extends EditorTemplate<InitParamBean>
 {
     private static final long serialVersionUID = 1L;
     
+    static final Logger logger = LoggerFactory.getLogger(ParameterPanel.class);
+    
     private PortletApplicationNodeBean paNodeBean;
     private String newName;
     private String newLocale;
@@ -76,14 +80,14 @@
     }
 
     @Override
-    public void buildItems(Fragment fragment, final InitParamBean initParam)
+    public void buildItems(Fragment fragment, final InitParamBean initParamBean)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
 
-        fragment.add(new TextField<String>("name", new PropertyModel<String>(new InitParamBeanModel(locator, paNodeBean, initParam), "paramName")));
-        fragment.add(new TextField<String>("value", new PropertyModel<String>(new InitParamBeanModel(locator, paNodeBean, initParam), "paramValue")));
+        fragment.add(new TextField<String>("name", new PropertyModel<String>(new InitParamBeanModel(locator, paNodeBean, initParamBean), "paramName")));
+        fragment.add(new TextField<String>("value", new PropertyModel<String>(new InitParamBeanModel(locator, paNodeBean, initParamBean), "paramValue")));
 
-        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, initParam.getParamName())
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, initParamBean.getParamName())
         {
 
             @Override
@@ -93,7 +97,7 @@
                 PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                 PortletDefinition def = app.getPortlet(paNodeBean.getName());
 
-                final InitParam param = def.getInitParam(initParam.getParamName());
+                final InitParam param = def.getInitParam(initParamBean.getParamName());
 
                 List<DescriptionBean> list = new ArrayList<DescriptionBean>();
 
@@ -104,7 +108,7 @@
 
                 return new ListDataProvider<DescriptionBean>(list);
             }
-
+            
             @Override
             protected Button saveButton(String componentId)
             {
@@ -120,15 +124,25 @@
                         
                         if (newLocale != null && newDescription != null)
                         {
+                            InitParam initParam = def.getInitParam(initParamBean.getParamName());
                             Locale locale = new Locale(newLocale);
-                            Description description = def.getDescription(locale);
+                            Description targetDescription = null;
+                            
+                            for (Description description : initParam.getDescriptions())
+                            {
+                                if (description.getLocale().equals(locale))
+                                {
+                                    targetDescription = description;
+                                    break;
+                                }
+                            }
                             
-                            if (description == null)
+                            if (targetDescription == null)
                             {
-                                description = def.addDescription(newLocale);
+                                targetDescription = initParam.addDescription(newLocale);
                             }
                             
-                            description.setDescription(newDescription);
+                            targetDescription.setDescription(newDescription);
                             
                             newLocale = null;
                             newDescription = null;
@@ -140,8 +154,7 @@
                         }
                         catch (RegistryException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            logger.error("Failed to save portlet definition.", e);
                         }
                     }
                 };
@@ -178,8 +191,7 @@
                 }
                 catch (FailedToStorePortletDefinitionException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to save portlet definition.", e);
                 }
             }
         });
@@ -215,8 +227,7 @@
         }
         catch (RegistryException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Failed to save portlet definition.", e);
         }
 
     }
@@ -281,8 +292,7 @@
                 }
                 catch (RegistryException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to save portlet definition.", e);
                 }
             }
         };

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java Mon May  4 10:18:30 2009
@@ -17,14 +17,18 @@
 package org.apache.jetspeed.portlets.prm.portlet;
 
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.components.portletregistry.RegistryException;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.om.portlet.Preference;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.prm.model.PreferenceModel;
 import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.jetspeed.portlets.wicket.component.editor.EditorTemplate;
 import org.apache.wicket.markup.html.form.Button;
@@ -34,15 +38,19 @@
 import org.apache.wicket.markup.repeater.RefreshingView;
 import org.apache.wicket.markup.repeater.util.ModelIteratorAdapter;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class PreferencePanel extends EditorTemplate<Preference>
 {
     private static final long serialVersionUID = 1L;
     
+    static final Logger logger = LoggerFactory.getLogger(PreferencePanel.class);
+    
     private PortletApplicationNodeBean paNodeBean;
     private String newName, newValue;
+    private transient List<Preference> curPrefs;
 
     public PreferencePanel(String id, PortletApplicationNodeBean paNodeBean)
     {
@@ -58,30 +66,39 @@
     {
         return new Button(componentId)
         {
+            private static final long serialVersionUID = 1L;
+
             @Override
             public void onSubmit()
             {
-                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
-                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
-                PortletDefinition def = app.getPortlet(paNodeBean.getName());
-                
-                if (newName != null && newValue != null)
+                try
                 {
-                    Preference pref = def.getPortletPreferences().addPreference(newName);
-                    pref.addValue(newValue);
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
+                    PortletPreferencesProvider prefProvider = (PortletPreferencesProvider) 
+                        ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
+                        .getService(CommonPortletServices.CPS_PORTLET_PREFERENCES_PROVIDER);
                     
-                    newName = null;
-                    newValue = null;
-                }
+                    if (newName != null && newValue != null)
+                    {
+                        Preference pref = def.getPortletPreferences().addPreference(newName);
+                        pref.addValue(newValue);
+                        
+                        prefProvider.storeDefaults(def, pref);
+                        
+                        newName = null;
+                        newValue = null;
+                    }
 
-                try
-                {
-                    registry.savePortletDefinition(def);
+                    for (Preference pref : curPrefs)
+                    {
+                        prefProvider.storeDefaults(def, pref);
+                    }
                 }
-                catch (RegistryException e)
+                catch (Exception e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    logger.error("Failed to store portlet default preferences.", e);
                 }
             }
         };
@@ -103,21 +120,24 @@
     @Override
     public void buildItems(Fragment fragment, final Preference preference)
     {
-        fragment.add(new TextField<String>("name", new PropertyModel(preference, "name")));
+        fragment.add(new TextField<String>("name", new PropertyModel<String>(preference, "name")));
         
         RefreshingView<String> view = new RefreshingView<String>("values")
         {
+            private static final long serialVersionUID = 1L;
+
             @Override
             protected Iterator<IModel<String>> getItemModels()
             {
-                return new ModelIteratorAdapter<String>(preference.getValues().iterator())
+                List<IModel<String>> preferenceValueModels = new LinkedList<IModel<String>>();
+                int preferenceCount = preference.getValues().size();
+                
+                for (int i = 0; i < preferenceCount; i++)
                 {
-                    @Override
-                    protected IModel<String> model(String object)
-                    {
-                        return new Model<String>(object);
-                    }
-                };
+                    preferenceValueModels.add(new PropertyModel<String>(preference, "values." + i));
+                }
+
+                return preferenceValueModels.iterator();
             }
 
             @Override
@@ -133,52 +153,42 @@
     @Override
     public void delete(IModel<Preference>[] fields)
     {
-        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
-        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
-        PortletDefinition def = app.getPortlet(paNodeBean.getName());
-        
-        for (IModel<Preference> field : fields)
+        try
         {
-            Iterator<Preference> it = def.getPortletPreferences().getPortletPreferences().iterator();
+            PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+            PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+            PortletDefinition def = app.getPortlet(paNodeBean.getName());
+            PortletPreferencesProvider prefProvider = (PortletPreferencesProvider) 
+                ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
+                .getService(CommonPortletServices.CPS_PORTLET_PREFERENCES_PROVIDER);
             
-            while (it.hasNext())
+            for (IModel<Preference> field : fields)
             {
-                Preference pref = it.next();
-                
-                if (pref.getName().equals(field.getObject().getName()))
-                {
-                    it.remove();
-                    break;
-                }
+                prefProvider.removeDefaults(def, field.getObject().getName());
             }
         }
-
-        try
+        catch (Exception e)
         {
-            registry.savePortletDefinition(def);
-        }
-        catch (RegistryException e)
-        {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Failed to remove portlet default preference.", e);
         }
     }
 
     @Override
     public Iterator<IModel<Preference>> getItemModels()
     {
-        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        final JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletRegistry registry = locator.getPortletRegistry();
         PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
         PortletDefinition def = app.getPortlet(paNodeBean.getName());
 
-        List<Preference> prefs = def.getPortletPreferences().getPortletPreferences();
+        curPrefs = def.getPortletPreferences().getPortletPreferences();
         
-        return new ModelIteratorAdapter<Preference>(prefs.iterator())
+        return new ModelIteratorAdapter<Preference>(curPrefs.iterator())
         {
             @Override
             protected IModel<Preference> model(Preference preference)
             {
-                return new Model<Preference>(preference);
+                return new PreferenceModel(locator, paNodeBean, preference);
             }
         };
     }
@@ -186,6 +196,8 @@
     @Override
     public IModel<Preference> getNewRowModel(Preference preference)
     {
-        return new Model<Preference>(preference);
+        final JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        return new PreferenceModel(locator, paNodeBean, preference);
     }
+    
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/profiler/WicketProfilerAdmin.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/profiler/WicketProfilerAdmin.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/profiler/WicketProfilerAdmin.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/profiler/WicketProfilerAdmin.java Mon May  4 10:18:30 2009
@@ -52,9 +52,13 @@
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.validation.IValidatable;
 import org.apache.wicket.validation.validator.AbstractValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class WicketProfilerAdmin extends AdminPortletWebPage {
 
+    static final Logger logger = LoggerFactory.getLogger(WicketProfilerAdmin.class);
+    
     protected ProfilingRule profilingRule;
 
     public WicketProfilerAdmin() {
@@ -106,8 +110,7 @@
                 }
                 catch (Exception e)
                 {
-                    e.printStackTrace();
-                    // TODO add error message to feedback panel            
+                    logger.error("Failed to set rule.", e);
                 }
             }
             
@@ -188,9 +191,7 @@
                             getRules().add(profilingRule);
                         }
                     } catch (ProfilerException e) {
-                        System.out.println("Failed to UPDATE: rule = " + profilingRule.getId());
-                        e.printStackTrace();
-                        // TODO add error message to feedback panel
+                        logger.error("Failed to update rule: " + profilingRule, e);
                     }
                 }
                 
@@ -209,9 +210,7 @@
                         profilingRule = null;
                         RuleEditPanel.this.setVisible(false);
                     } catch (ProfilerException e) {
-                        System.out.println("Failed to REMOVE: rule = " + profilingRule.getId());
-                        e.printStackTrace();
-                        // TODO add error message to feedback panel
+                        logger.error("Failed to REMOVE: " + profilingRule, e);
                     }
                 }
                 
@@ -280,9 +279,7 @@
                         criterion = profiler.createRuleCriterion();
                         criterionEditPanel.setVisible(true);
                     } catch (ClassNotFoundException e) {
-                        // TODO put message on feedback panel
-                        e.printStackTrace();
-                        System.out.println("Could not create new rule criterion: " + e.getMessage());
+                        logger.error("Could not create new rule criterion.", e);
                     }
                 }
                 
@@ -410,9 +407,7 @@
                             profiler.storeProfilingRule(profilingRule);
                         }
                         catch (ProfilerException e) {
-                            // TODO set feeback message
-                            e.printStackTrace();
-                            System.out.println("Could not save rule criterion " + criterion.getName() + ": " + e.getMessage());
+                            logger.error("Could not save rule criterion {}: {}", criterion.getName(), e.getMessage());
                         }
                     }
                     
@@ -430,9 +425,7 @@
                             profiler.storeProfilingRule(profilingRule);
                         }
                         catch (ProfilerException e) {
-                            // TODO set feeback message
-                            e.printStackTrace();
-                            System.out.println("Could not save rule criterion " + criterion.getName() + ": " + e.getMessage());
+                            logger.error("Could not save rule criterion {}: {}", criterion.getName(), e.getMessage());
                         }
                     }
                     

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java Mon May  4 10:18:30 2009
@@ -17,15 +17,9 @@
 package org.apache.jetspeed.portlets.rpad;
 
 import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import javax.portlet.ActionRequest;
-import javax.portlet.PortletRequest;
 import javax.portlet.ReadOnlyException;
-import javax.portlet.RenderRequest;
 import javax.portlet.ValidatorException;
 
 import org.apache.jetspeed.portlets.AdminPortletWebPage;
@@ -48,6 +42,8 @@
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
@@ -55,6 +51,8 @@
  */
 public class RPADEditor extends AdminPortletWebPage
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(RPADEditor.class);
 
     private RepositoryManager repositoryManager;
 
@@ -107,7 +105,7 @@
                             target.addComponent(tableGroup);
                         } catch (ReadOnlyException e)
                         {
-                            e.printStackTrace();
+                            logger.error("The preference is read-only: {}", REPO_PREFIX + repo.getName());
                         }
                     }                    
                 });
@@ -234,18 +232,18 @@
             getPortletRequest().getPreferences().setValue(REPO_PREFIX + name, repoUrl);
             getPortletRequest().getPreferences().store();
             getRepositoryManager().reload(RemotePortletAppDeployer.getReposList(getPortletRequest()));
-        } catch (ReadOnlyException e)
+        }
+        catch (ReadOnlyException e)
+        {
+            logger.error("The preference is read-only: {}", REPO_PREFIX + name);
+        }
+        catch (ValidatorException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ValidatorException e)
-        {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (IOException e)
+            logger.error("The preference value of {} is invalid: {}", REPO_PREFIX + name, repoUrl);
+        }
+        catch (IOException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Unexpected IO error.", e);
         } 
     }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Mon May  4 10:18:30 2009
@@ -93,7 +93,7 @@
 public class JetspeedPrincipalManagementPortlet extends AdminPortletWebPage
 {
 
-    private Logger log = LoggerFactory.getLogger(JetspeedPrincipalManagementPortlet.class);
+    static final Logger log = LoggerFactory.getLogger(JetspeedPrincipalManagementPortlet.class);
 
     private static final String principalParamName = "principalParam";
 
@@ -313,9 +313,10 @@
                         getPrincipal().setEnabled(isUserEnabled());
                         getManager().updatePrincipal(principal);
                         setPrincipal(principal);
-                    } catch (SecurityException jSx)
+                    }
+                    catch (SecurityException jSx)
                     {
-                        jSx.printStackTrace();
+                        log.error("Failed to update principal.", jSx);
                     }
                 }
                 
@@ -523,9 +524,10 @@
                         this.userRules.add(ruleMap);
                     }
                 }
-            } catch (Exception e)
+            }
+            catch (Exception e)
             {
-                e.printStackTrace();
+                log.error("Failed to add user rules.", e);
             }
         }
 
@@ -701,9 +703,10 @@
                         userManager.storePasswordCredential(credential);
                         setPrincipal(user);
                         controlPannels(true);
-                    } catch (SecurityException jSx)
+                    }
+                    catch (SecurityException jSx)
                     {
-                        jSx.printStackTrace();
+                        log.error("Failed to update user.", jSx);
                     }
                 }
 
@@ -753,7 +756,7 @@
 					}
 				    catch (SecurityException jSx)
 	                {
-				        jSx.printStackTrace();
+				        log.error("Failed to add principal.", jSx);
 	                }
 				}            	
             };
@@ -1205,9 +1208,10 @@
                 setCredentialExpirationDate(credential.getExpirationDate());
                 setUserExpiredFlag(credential.isExpired() ? "expired"
                         : "active");
-            } catch (SecurityException secExp)
+            }
+            catch (SecurityException secExp)
             {
-                secExp.printStackTrace();
+                log.error("Failed to refresh user credentials.", secExp);
             }
         }
     }
@@ -1272,9 +1276,10 @@
                                             .removeAttribute(attrib.getName());
                                     getManager()
                                             .updatePrincipal(getPrincipal());
-                                } catch (SecurityException e)
+                                }
+                                catch (SecurityException e)
                                 {
-                                    e.printStackTrace();
+                                    log.error("Failed to update principal.", e);
                                 }
                                 setPrincipal(getPrincipal());
                                 refreshData();
@@ -1307,10 +1312,10 @@
                         try
                         {
                             getPrincipal().getSecurityAttributes().getAttribute(userAttrName).setStringValue(userAttrName);
-                        } catch (SecurityException e)
+                        }
+                        catch (SecurityException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            log.error("Failed to update security attribute of principal.", e);
                         }
                         attribs.put(userAttrName, userAttrValue);
                         getServiceLocator()
@@ -1358,10 +1363,10 @@
                                             "",
                                             userAttrValue,
                                             AdminPortletWebPage.USER_ADMINISTRATION);
-                        } catch (SecurityException e)
+                        }
+                        catch (SecurityException e)
                         {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
+                            log.error("Failed to update security attribute of principal.", e);
                         }
                     }
                     setPrincipal(getPrincipal());
@@ -1603,9 +1608,10 @@
                                     fromPrincipal, associationName);
                         }
                         refreshList();
-                    } catch (SecurityException sExc)
+                    }
+                    catch (SecurityException sExc)
                     {
-                        sExc.printStackTrace();
+                        log.error("Failed to add associations.", sExc);
                     }
                 }
             };

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/SecurityUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/SecurityUtil.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/SecurityUtil.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/SecurityUtil.java Mon May  4 10:18:30 2009
@@ -30,6 +30,8 @@
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.portals.applications.gems.browser.BrowserPortlet;
 import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -39,7 +41,9 @@
  * @version $Id: SecurityUtil.java 348264 2005-11-22 22:06:45Z taylor $
  */
 public abstract class SecurityUtil extends BrowserPortlet
-{    
+{
+    
+    static final Logger logger = LoggerFactory.getLogger(SecurityUtil.class);
         
     public static Principal getPrincipal(Subject subject, Class classe)
     {
@@ -93,8 +97,7 @@
         }
         catch (NotSerializableException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Message to publish is not serializable.", e);
         }                
     }
     
@@ -112,8 +115,7 @@
         }
         catch (NotSerializableException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.error("Message to publish is not serializable.", e);
         }                
     }
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/GroupChooserPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/GroupChooserPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/GroupChooserPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/GroupChooserPortlet.java Mon May  4 10:18:30 2009
@@ -29,6 +29,8 @@
 import org.apache.portals.applications.gems.browser.BrowserIterator;
 import org.apache.portals.applications.gems.browser.BrowserPortlet;
 import org.apache.portals.applications.gems.browser.DatabaseBrowserIterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * GroupChooserPortlet
@@ -38,6 +40,9 @@
  */
 public class GroupChooserPortlet extends BrowserPortlet
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(GroupChooserPortlet.class);
+    
     private GroupManager groupManager;
     
     public void init(PortletConfig config)
@@ -72,8 +77,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            logger.error("Exception in getRows: ", e);
             throw e;
         }        
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/RoleChooserPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/RoleChooserPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/RoleChooserPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/RoleChooserPortlet.java Mon May  4 10:18:30 2009
@@ -29,6 +29,8 @@
 import org.apache.portals.applications.gems.browser.BrowserIterator;
 import org.apache.portals.applications.gems.browser.BrowserPortlet;
 import org.apache.portals.applications.gems.browser.DatabaseBrowserIterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * RoleChooserPortlet
@@ -38,6 +40,9 @@
  */
 public class RoleChooserPortlet extends BrowserPortlet
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(RoleChooserPortlet.class);
+    
     private RoleManager roleManager;
     
     public void init(PortletConfig config)
@@ -72,8 +77,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            logger.error("Exception in getRows: ", e);
             throw e;
         }        
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/UserChooserPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/UserChooserPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/UserChooserPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/choosers/UserChooserPortlet.java Mon May  4 10:18:30 2009
@@ -28,6 +28,8 @@
 import org.apache.jetspeed.security.UserManager;
 import org.apache.portals.applications.gems.browser.BrowserIterator;
 import org.apache.portals.applications.gems.browser.DatabaseBrowserIterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * SSOBrowser
@@ -37,6 +39,9 @@
  */
 public class UserChooserPortlet extends SecurityUtil
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(UserChooserPortlet.class);
+    
     private UserManager userManager;
     
     public void init(PortletConfig config)
@@ -68,8 +73,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            logger.error("Exception in getRows: ", e);
             throw e;
         }        
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/constraints/ConstraintsViewController.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/constraints/ConstraintsViewController.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/constraints/ConstraintsViewController.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/constraints/ConstraintsViewController.java Mon May  4 10:18:30 2009
@@ -33,12 +33,11 @@
 import org.apache.jetspeed.security.GroupManager;
 import org.apache.jetspeed.security.Role;
 import org.apache.jetspeed.security.RoleManager;
-import org.springframework.beans.factory.InitializingBean;
 import org.springframework.web.portlet.ModelAndView;
 import org.springframework.web.portlet.context.PortletConfigAware;
 import org.springframework.web.portlet.mvc.AbstractController;
 
-public class ConstraintsViewController extends AbstractController implements InitializingBean, PortletConfigAware
+public class ConstraintsViewController extends AbstractController implements PortletConfigAware
 {	
     private static final String     ROLES_CACHE_SESSION_ATTRIBUTE_NAME = "j2Roles";
     private static final String     GROUPS_CACHE_SESSION_ATTRIBUTE_NAME = "j2Groups";
@@ -49,12 +48,6 @@
     protected RoleManager rm = null;
     protected GroupManager gm = null;
     
-    public void afterPropertiesSet() throws Exception 
-    {
-//        System.out.println("+++ after property set");
-        //throw new IllegalArgumentException("A DOMTreeService is required");
-    }
-    
 	public ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception
 	{
 		Map model = new HashMap();
@@ -74,7 +67,6 @@
             {
                 roles = rm.getRoles("");
                 session.setAttribute(ROLES_CACHE_SESSION_ATTRIBUTE_NAME, roles, PortletSession.PORTLET_SCOPE);
-//                System.out.println( "roles: " + roles.toString() );
             }
             catch(Exception e)
             {
@@ -90,7 +82,6 @@
             {
                 groups = gm.getGroups("");
                 session.setAttribute(GROUPS_CACHE_SESSION_ATTRIBUTE_NAME, groups, PortletSession.PORTLET_SCOPE);
-//                System.out.println( "groups: " + groups.toString() );
             }
             catch(Exception e)
             {
@@ -106,7 +97,6 @@
 	       
     public void setPortletConfig(PortletConfig portletConfig)
     {   
-//        System.out.println("+++ in set portlet config");
         this.portletConfig = portletConfig;
         pageManager = (PageManager) getPortletContext().getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);        
         if (null == pageManager) 
@@ -123,7 +113,6 @@
         if (gm == null)
             throw new RuntimeException("Could not get instance of portal group manager component");
 
-//        System.out.println("--- out set portlet config:" + pageManager);
     }
 
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java Mon May  4 10:18:30 2009
@@ -51,7 +51,7 @@
  */
 public class SecurityPermissionsPortlet extends AbstractAdminDojoVelocityPortlet
 {
-    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+    static final Logger logger = LoggerFactory.getLogger(SecurityPermissionsPortlet.class);
     protected PermissionManager pm = null;
     protected RoleManager rm = null;
     

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java Mon May  4 10:18:30 2009
@@ -43,6 +43,8 @@
 import org.apache.portals.applications.gems.browser.StatusMessage;
 import org.apache.portals.messaging.PortletMessaging;
 import org.apache.velocity.context.Context;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * SSOBrowser
@@ -52,6 +54,9 @@
  */
 public class SSOBrowser extends BrowserPortlet
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(SSOBrowser.class);
+    
     private SSOManager sso;
     
     public void init(PortletConfig config)
@@ -98,8 +103,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            logger.error("Exception in getRows: ", e);
             throw e;
         }        
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSODetails.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSODetails.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSODetails.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/sso/SSODetails.java Mon May  4 10:18:30 2009
@@ -20,9 +20,7 @@
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -50,6 +48,8 @@
 import org.apache.portals.applications.gems.browser.StatusMessage;
 import org.apache.portals.messaging.PortletMessaging;
 import org.apache.velocity.context.Context;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * SSODetails
@@ -59,6 +59,9 @@
  */
 public class SSODetails extends BrowserPortlet
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(SSODetails.class);
+    
     private SSOManager sso;
     private UserManager userManager;
     private GroupManager groupManager;
@@ -121,8 +124,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            logger.error("Exception in getRows: ", e);
             throw e;
         }        
     }
@@ -275,7 +277,7 @@
                                 }
                                 catch (Exception e)
                                 {
-                                    System.err.println("Failed to publish message: " + e);
+                                    logger.error("Failed to publish message: {}", e);
                                 }
                         	} else {
                             	sso.addUser(site, localPrincipal, remotePrincipal, remoteCredential);                            

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/CategoryPortletSelector.java Mon May  4 10:18:30 2009
@@ -40,8 +40,6 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.PortalReservedParameters;
@@ -64,6 +62,8 @@
 import org.apache.jetspeed.search.SearchEngine;
 import org.apache.jetspeed.security.SecurityAccessController;
 import org.apache.velocity.context.Context;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * CategoryPortletSelector selects categories organized by categories
@@ -73,6 +73,9 @@
  */
 public class CategoryPortletSelector extends AbstractAdminDojoVelocityPortlet implements Comparator
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(CategoryPortletSelector.class);
+    
     public final String[] DEFAULT_IMAGES = new String[]
     {
             "images/portlets/applications-development.png",
@@ -80,7 +83,7 @@
             "images/portlets/applications-other.png",
             "images/portlets/linux.png"
     };
-    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
     public final static String PORTLET_ICON = "portlet-icon";
     protected final static String PORTLETS = "category.selector.portlets";
     protected final static String CATEGORIES = "category.selector.categories";
@@ -297,7 +300,8 @@
 		String usrPortletName = null;
 		PortletInfo tmpPortletInfo = null;
 		String portletName;
-		try {
+		try 
+		{
 			Map usrPortlet = getUserPortlet(getPage(request));
 			sPortletCnt = sysPortlets.size();
 			for (int si = 0; si < sPortletCnt; si++) {
@@ -313,8 +317,10 @@
 				list.add(tmpPortletInfo);
 				tmpPortletInfo = null;
 			}
-		} catch (Exception e) {
-			e.printStackTrace();
+		} 
+		catch (Exception e) 
+		{
+			logger.error("Unexpected error during retrieving portlet infos.", e);
 		}
 		return list;
 	}
@@ -537,7 +543,6 @@
                         count++;
                     }
                     cats = temp.toString();
-                    //System.out.println("cats = [" + cats + "]");
                     modifyPref("Categories", cats, portlet);
                     
                     // finally save it all
@@ -714,7 +719,8 @@
 		CategoryInfo catInfo = null;
 		int strtCnt = getStartRow(pageNumber, portletPerPages);
 		int endCnt = getEndRow(pageNumber, portletPerPages);
-		try {			
+		try 
+		{			
 			if (category.equalsIgnoreCase("all")) {				
 				tmpList = retrievePortlets(request, filter);
 				portletCount = tmpList.size();
@@ -748,8 +754,10 @@
 					list.add(catList.get(index));
 				}
 			}
-		} catch (Exception e) {
-			e.printStackTrace();
+		}
+		catch (Exception e) 
+		{
+			logger.error("Unexpected error during retrieving portlet infos.", e);
 		}
 		return new CategoryResult(list, portletCount);
 	}
@@ -767,7 +775,8 @@
 	private Map getUserPortlet(Page page) {
 		int portletCount = 0;
 		Map map = new HashMap();
-		try {
+		try 
+		{
 			Fragment fragment;
 			Iterator it = page.getRootFragment().getFragments().iterator();
 			while (it.hasNext()) {
@@ -779,9 +788,10 @@
 					map.put(fragment.getName(), new Integer(1));
 				}
 			}
-		} catch (Exception e) {
-//			System.out.println(e.getMessage());
-			e.printStackTrace();
+		}
+		catch (Exception e) 
+		{
+		    logger.error("Unexpected error during retrieving fragments information.", e);
 		}
 		return map;
 	}

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/PortletSelector.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/PortletSelector.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/PortletSelector.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/selector/PortletSelector.java Mon May  4 10:18:30 2009
@@ -49,6 +49,8 @@
 import org.apache.portals.applications.gems.browser.BrowserPortlet;
 import org.apache.portals.gems.util.StatusMessage;
 import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Selects one or more portlets
@@ -59,6 +61,8 @@
 public class PortletSelector extends BrowserPortlet
 {
     
+    static final Logger logger = LoggerFactory.getLogger(PortletSelector.class);
+    
     protected static final String CHECKEDSET = "checkedSet";
     protected static final String UNCHECKEDSET = "unCheckedSet";
    
@@ -268,8 +272,7 @@
         }
         catch (Exception e)
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
+            log.error("Exception in getRows: ", e);
             throw e;
         }        
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/serializer/PortalDataSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/serializer/PortalDataSerializer.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/serializer/PortalDataSerializer.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/serializer/PortalDataSerializer.java Mon May  4 10:18:30 2009
@@ -42,6 +42,8 @@
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Wicket Serializer WebPage for import and export of portal data.
@@ -51,6 +53,9 @@
  */
 public class PortalDataSerializer extends AdminPortletWebPage
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(PortalDataSerializer.class);
+    
     private static final String USERS_GROUPS_ROLES = "usersGroupsRoles";
 
     private static final String PERMISSIONS = "permissions";
@@ -187,7 +192,7 @@
                 }
                 catch (Throwable t)
                 {
-                    t.printStackTrace();
+                    logger.error("Failed to delete export file {}: {}", this.exportFile, t.getMessage());
                 }
             }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java Mon May  4 10:18:30 2009
@@ -30,6 +30,8 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.LocalizedField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
@@ -37,6 +39,9 @@
  */
 public class JetspeedDocument implements Serializable
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(JetspeedDocument.class);
+    
     private static final long serialVersionUID = -7429444774638220814L;
     private String name;
     private String title;
@@ -358,7 +363,7 @@
         }
         catch (UnsupportedEncodingException e)
         {
-            e.printStackTrace();
+            logger.error("Unsupported encoding: UTF-8");
             return pageName;
         }
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java Mon May  4 10:18:30 2009
@@ -130,7 +130,7 @@
 public class PortalSiteManager extends AdminPortletWebPage
 {
 
-    protected final Logger log = LoggerFactory.getLogger(this.getClass());
+    protected static final Logger log = LoggerFactory.getLogger(PortalSiteManager.class);
     // components
     protected PortletRegistry registry;
 
@@ -226,10 +226,10 @@
                 {
                     userNames = getServiceLocator().getUserManager()
                             .getUserNames(input);
-                } catch (SecurityException e)
+                }
+                catch (SecurityException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    log.error("Failed to retrieve user names.", e);
                 }
                 if (userNames == null)
                 {
@@ -1354,7 +1354,7 @@
                                 }
                             } catch (Exception e)
                             {
-                                e.printStackTrace();
+                                log.error("Unexpected error during uploading page(s) or folder(s).", e);
                             }
                         }
                     }
@@ -2703,10 +2703,10 @@
                     {
                         folderAction(tmpFolder, REMOVE_ACTION);
                     }
-                } catch (NodeException e)
+                }
+                catch (NodeException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    log.error("Failed to copy folder.", e);
                 }
             } else if (docType == FileType.Page)
             {
@@ -2722,10 +2722,10 @@
                     {
                         PageAction(tmpPage, REMOVE_ACTION);
                     }
-                } catch (NodeException e)
+                }
+                catch (NodeException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    log.error("Failed to copy page.", e);
                 }
             } else if (docType == FileType.Link)
             {
@@ -2741,10 +2741,10 @@
                     {
                         linkAction(tmpLink, REMOVE_ACTION);
                     }
-                } catch (NodeException e)
+                }
+                catch (NodeException e)
                 {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    log.error("Failed to copy link.", e);
                 }
             }
         }
@@ -3235,10 +3235,10 @@
                 tmpNode.setAllowsChildren(false);
                 rootNode.add(tmpNode);
             }
-        } catch (Exception e)
+        }
+        catch (Exception e)
         {
-            // log.error("Failed to retrieve folders ", e);
-            e.printStackTrace();
+            log.error("Failed to retrieve folders ", e);
         }
         return rootNode;
     }
@@ -3273,10 +3273,10 @@
                             folder)));
                 }
             }
-        } catch (Exception e)
+        }
+        catch (Exception e)
         {
-            // log.error("Failed to retrieve folders ", e);
-            e.printStackTrace();
+            log.error("Failed to retrieve folders ", e);
         }
         return rootNode;
     }
@@ -3356,18 +3356,18 @@
                             .add(((SecurityConstraintsDef) constraintsDefIterator
                                     .next()).getName());
                 }
-            } catch (UnsupportedDocumentTypeException e)
+            }
+            catch (UnsupportedDocumentTypeException e)
+            {
+                log.error("Unsupported document type.", e);
+            }
+            catch (DocumentNotFoundException e)
             {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            } catch (DocumentNotFoundException e)
-            {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            } catch (NodeException e)
+                log.error("Document is not found.", e);
+            }
+            catch (NodeException e)
             {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
             }
 
         }
@@ -3391,9 +3391,10 @@
                 document = new JetspeedDocument(getServiceLocator()
                         .getPageManager().getLink(node.getNodePath()));
             }
-        } catch (Exception e)
+        }
+        catch (Exception e)
         {
-            e.printStackTrace();
+            log.error("Failed populate document.", e);
         }
     }
 
@@ -3550,9 +3551,10 @@
                         .getNodeName(), userName, siteNode.getDocType()
                         .toString());
                 jetspeedObject = new ExportObject(downloadPath, contentType);
-            } catch (Exception e)
+            }
+            catch (Exception e)
             {
-                e.printStackTrace();
+                log.error("Failed to export site node.", e);
             }
         }
         return jetspeedObject;
@@ -3597,9 +3599,10 @@
             }
             zipFile.close();
             return true;
-        } catch (IOException ioe)
+        }
+        catch (IOException ioe)
         {
-            ioe.printStackTrace();
+            log.error("Unexpected IO exception.", ioe);
             return false;
         }
     }
@@ -3829,14 +3832,14 @@
                     documentOrder.add(documentName);
                 }
             }
-        } catch (InvalidFolderException e)
+        }
+        catch (InvalidFolderException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (NodeException e)
+            log.error("Invalid folder.", e);
+        }
+        catch (NodeException e)
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error("Unexpected exception.", e);
         }
     }
 
@@ -4285,17 +4288,20 @@
         try
         {
             page = getServiceLocator().getPageManager().getPage(pagePath);
-        } catch (PageNotFoundException e)
+        }
+        catch (PageNotFoundException e)
         {
-            e.printStackTrace();
+            log.error("Page is not found: {}", pagePath);
             return null;
-        } catch (InvalidFolderException e)
+        }
+        catch (InvalidFolderException e)
         {
-            e.printStackTrace();
+            log.error("Invalid folder path: {}", pagePath);
             return null;
-        } catch (NodeException e)
+        }
+        catch (NodeException e)
         {
-            e.printStackTrace();
+            log.error("Unexpected exception.", e);
             return null;
         }
         return page;
@@ -4307,21 +4313,25 @@
         try
         {
             link = getServiceLocator().getPageManager().getLink(pagePath);
-        } catch (PageNotFoundException e)
+        }
+        catch (PageNotFoundException e)
         {
-            e.printStackTrace();
+            log.error("Page is not found: {}", pagePath);
             return null;
-        } catch (InvalidFolderException e)
+        }
+        catch (InvalidFolderException e)
         {
-            e.printStackTrace();
+            log.error("Invalid folder path: {}", pagePath);
             return null;
-        } catch (NodeException e)
+        } 
+        catch (NodeException e)
         {
-            e.printStackTrace();
+            log.error("Unexpected exception.", e);
             return null;
-        } catch (DocumentNotFoundException e)
+        }
+        catch (DocumentNotFoundException e)
         {
-            e.printStackTrace();
+            log.error("Document is not found: {}", pagePath);
             return null;
         }
         return link;
@@ -4333,17 +4343,20 @@
         try
         {
             folder = getServiceLocator().getPageManager().getFolder(folderPath);
-        } catch (FolderNotFoundException e)
+        }
+        catch (FolderNotFoundException e)
         {
-            e.printStackTrace();
+            log.error("Folder is not found: {}", folderPath);
             return null;
-        } catch (InvalidFolderException e)
+        }
+        catch (InvalidFolderException e)
         {
-            e.printStackTrace();
+            log.error("Invalid folder path: {}", folderPath);
             return null;
-        } catch (NodeException e)
+        }
+        catch (NodeException e)
         {
-            e.printStackTrace();
+            log.error("Unexpected exception.", e);
             return null;
         }
         return folder;
@@ -4356,27 +4369,32 @@
             try
             {
                 getServiceLocator().getPageManager().updateFolder(folder);
-            } catch (FolderNotUpdatedException e)
+            }
+            catch (FolderNotUpdatedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not updated.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
-        } else if (action.equals(REMOVE_ACTION))
+        }
+        else if (action.equals(REMOVE_ACTION))
         {
             try
             {
                 getServiceLocator().getPageManager().removeFolder(folder);
-            } catch (FolderNotRemovedException e)
+            }
+            catch (FolderNotRemovedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not removed.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
         }
@@ -4390,27 +4408,32 @@
             try
             {
                 getServiceLocator().getPageManager().updatePage(page);
-            } catch (FolderNotUpdatedException e)
+            }
+            catch (FolderNotUpdatedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not updated.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
-        } else if (action.equals(REMOVE_ACTION))
+        }
+        else if (action.equals(REMOVE_ACTION))
         {
             try
             {
                 getServiceLocator().getPageManager().removePage(page);
-            } catch (FolderNotRemovedException e)
+            }
+            catch (FolderNotRemovedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not removed.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
         }
@@ -4424,27 +4447,32 @@
             try
             {
                 getServiceLocator().getPageManager().updateLink(link);
-            } catch (FolderNotUpdatedException e)
+            }
+            catch (FolderNotUpdatedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not updated.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
-        } else if (action.equals(REMOVE_ACTION))
+        }
+        else if (action.equals(REMOVE_ACTION))
         {
             try
             {
                 getServiceLocator().getPageManager().removeLink(link);
-            } catch (FolderNotRemovedException e)
+            }
+            catch (FolderNotRemovedException e)
             {
-                e.printStackTrace();
+                log.error("Folder is not removed.", e);
                 return false;
-            } catch (NodeException e)
+            }
+            catch (NodeException e)
             {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
                 return false;
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message