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 [2/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
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
Mon May  4 10:18:30 2009
@@ -28,6 +28,8 @@
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
@@ -35,6 +37,9 @@
  */
 public class PortalSiteManagerUtil
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(PortalSiteManagerUtil.class);
+    
     private static String pathSeprator = System.getProperty("file.separator");
     private static String pageRoot = System.getProperty("java.io.tmpdir");
 
@@ -104,22 +109,36 @@
         }
         else
         {
+            FileInputStream cpFileInputStream = null;
+            
             try
             {
                 String strAbsPath = cpFile.getAbsolutePath();
                 String strZipEntryName = strAbsPath.substring(sourcePath.length() + 1, strAbsPath.length());
                 byte[] b = new byte[(int) (cpFile.length())];
-                FileInputStream cpFileInputStream = new FileInputStream(cpFile);
+                cpFileInputStream = new FileInputStream(cpFile);
                 int i = cpFileInputStream.read(b, 0, (int) cpFile.length());
                 ZipEntry cpZipEntry = new ZipEntry(strZipEntryName);
                 cpZipOutputStream.putNextEntry(cpZipEntry);
                 cpZipOutputStream.write(b, 0, (int) cpFile.length());
                 cpZipOutputStream.closeEntry();
-                cpFileInputStream.close();
             }
             catch (Exception e)
             {
-                e.printStackTrace();
+                logger.error("Unexpected exception during zipping files.", e);
+            }
+            finally
+            {
+                if (cpFileInputStream != null)
+                {
+                    try 
+                    {
+                        cpFileInputStream.close();
+                    }
+                    catch (Exception ce)
+                    {
+                    }
+                }
             }
         }
     }
@@ -140,7 +159,9 @@
 
     private static boolean zipObject(String sourcePath, String target)
     {
+        FileOutputStream fos = null;
         ZipOutputStream cpZipOutputStream = null;
+        
         try
         {
             File cpFile = new File(sourcePath);
@@ -148,19 +169,40 @@
             {
                 return false;
             }
-            cpZipOutputStream = new ZipOutputStream(new FileOutputStream(target));
+            fos = new FileOutputStream(target);
+            cpZipOutputStream = new ZipOutputStream(fos);
             cpZipOutputStream.setLevel(9);
             zipFiles(cpFile, sourcePath, cpZipOutputStream);
             cpZipOutputStream.finish();
-            cpZipOutputStream.close();
         }
         catch (Exception e)
         {
-            e.printStackTrace();
+            logger.error("Unexpected exception during writing to zip output stream.", e);
             return false;
         }
         finally
         {
+            if (cpZipOutputStream != null)
+            {
+                try
+                {
+                    cpZipOutputStream.close();
+                }
+                catch (Exception ce)
+                {
+                }
+            }
+            
+            if (fos != null)
+            {
+                try
+                {
+                    fos.close();
+                }
+                catch (Exception ce)
+                {
+                }
+            }
         }
         return true;
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
Mon May  4 10:18:30 2009
@@ -34,6 +34,8 @@
 import org.apache.jetspeed.sso.SSOUser;
 import org.apache.portals.applications.gems.browser.StatusMessage;
 import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -43,6 +45,8 @@
 public abstract class SSOPortletUtil
 {
 
+    static final Logger logger = LoggerFactory.getLogger(SSOPortletUtil.class);
+    
     public static Subject getSubject()
     {
         AccessControlContext context = AccessController.getContext();
@@ -143,7 +147,7 @@
         }
         catch (Exception ee)
         {
-            System.err.println("Failed to publish message: " + e);
+            logger.error("Failed to publish message.", e);
         }
     }
     

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOTicketPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOTicketPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOTicketPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOTicketPortlet.java
Mon May  4 10:18:30 2009
@@ -33,9 +33,14 @@
 import org.apache.portals.applications.webcontent.rewriter.RewriterException;
 import org.apache.portals.applications.webcontent.rewriter.TicketParamRewriter;
 import org.apache.portals.applications.webcontent.rewriter.html.SwingParserAdaptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class SSOTicketPortlet extends SSOWebContentPortlet 
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(SSOTicketPortlet.class);
+    
     public final static String SSO_PREF_TICKET_NAME = "ticket.name";
     // sso.type
 	protected Class adaptorHtmlClass = SwingParserAdaptor.class;
@@ -81,7 +86,6 @@
                 String redirectLocation = locationHeader != null ? locationHeader.getValue()
: null ;
                 if (redirectLocation != null)
                 {
-                    // System.out.println("WebContentPortlet.doHttpWebContent() >>>handling
redirect to: "+redirectLocation+"<<<");                    
                     // one more time (assume most params are already encoded & new URL
is using GET protocol!)
                     return requestTicket( redirectLocation,null,null) ;
                 }
@@ -108,7 +112,7 @@
         }
         catch (Exception e) 
         {
-			e.printStackTrace();
+			logger.error("Unexpected error during request ticket.", e);
 		}	
     	return ticket;
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
Mon May  4 10:18:30 2009
@@ -55,7 +55,7 @@
     private static final String SESSION_TOTALSESSIONS = "totalsessions";
 
     /* CLF logger */
-    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+    static final Logger logger = LoggerFactory.getLogger(StatisticsPortlet.class);
 
     public void init(PortletConfig config) throws PortletException
     {

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/DynamicResourceLink.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/DynamicResourceLink.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/DynamicResourceLink.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/DynamicResourceLink.java
Mon May  4 10:18:30 2009
@@ -29,6 +29,8 @@
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
 import org.apache.wicket.util.time.Time;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
@@ -36,6 +38,9 @@
  */
 public class DynamicResourceLink extends Link implements IResourceListener
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(DynamicResourceLink.class);
+    
     private ResourceProvider resourceProvider;       
     public DynamicResourceLink(String id, IModel model)
     {
@@ -87,7 +92,7 @@
                     }
                     catch (Exception e)
                     {
-                        e.printStackTrace();
+                        logger.error("Failed to retrieve input stream from the resource.",
e);
                     }
                 }
                 return inputStream;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
Mon May  4 10:18:30 2009
@@ -39,7 +39,6 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Properties;
@@ -52,6 +51,8 @@
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.jetspeed.security.mfa.MFA;
 import org.apache.jetspeed.security.mfa.MultiFacetedAuthentication;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGImageDecoder;
@@ -64,6 +65,8 @@
 public final class CaptchaImageResource
 {
     private static final long serialVersionUID = 1L;
+    
+    static final Logger logger = LoggerFactory.getLogger(CaptchaImageResource.class);
 
     private String challengeId;
     private  List charAttsList;
@@ -139,9 +142,10 @@
         try
         {
             return getImageData();
-        } catch (IOException e)
+        }
+        catch (IOException e)
         {
-            e.printStackTrace();
+            logger.error("Unexpected exception during getImageBytes().", e);
         }
         return null;
     }
@@ -544,10 +548,12 @@
             fs = new FileOutputStream("/data/result.jpg");
             byte[] data = captcha.getImageBytes();
             fs.write(data);
-        } catch (IOException e)
+        }
+        catch (IOException e)
         {
-            e.printStackTrace(System.err);
-        } finally
+            logger.error("Unexpected exception during writing captcha image.", e);
+        } 
+        finally
         {
             try
             {

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
Mon May  4 10:18:30 2009
@@ -24,6 +24,8 @@
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.jetspeed.security.mfa.MFA;
 import org.apache.jetspeed.security.mfa.MultiFacetedAuthentication;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
@@ -31,6 +33,9 @@
  */
 public class MFAServletListener implements ServletContextListener
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(MFAServletListener.class);
+    
 	// TODO: Re-read the properties files as few times as possible.
 
     public void contextDestroyed(ServletContextEvent arg0)
@@ -63,7 +68,7 @@
         }
         catch (Throwable e)
         {
-            e.printStackTrace();
+            logger.error("Unexpected error during loading configuration.", e);
             PropertiesConfiguration config = new PropertiesConfiguration();
             PropertiesConfiguration ttsConfig = new PropertiesConfiguration();
             MultiFacetedAuthentication mfa = new MultiFacetedAuthenticationImpl(config, ttsConfig);

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
Mon May  4 10:18:30 2009
@@ -160,7 +160,7 @@
         } 
         catch (IOException e)
         {
-            e.printStackTrace(System.err);
+            log.error("Unexpected error during writing captch image.", e);
             imageUrl = "";
         } 
         finally

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
Mon May  4 10:18:30 2009
@@ -128,7 +128,6 @@
                 }
                 catch (Exception e)
                 {
-                    e.printStackTrace();
                     log.error("FileCache Scanner: Error in iteration...", e);           
        
                 }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
Mon May  4 10:18:30 2009
@@ -41,7 +41,6 @@
 import org.apache.jetspeed.security.AuthenticationProvider;
 import org.apache.jetspeed.security.PasswordCredential;
 import org.apache.jetspeed.security.SecurityAttribute;
-import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserCredential;
@@ -51,6 +50,8 @@
 import org.apache.jetspeed.security.mfa.util.SecurityHelper;
 import org.apache.portals.bridges.common.GenericServletPortlet;
 import org.apache.portals.messaging.PortletMessaging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
@@ -58,6 +59,9 @@
  */
 public class MFALogin extends GenericServletPortlet
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(MFALogin.class);
+    
     private UserManager userManager;
     private AuditActivity audit;
     private AuthenticationProvider authorization;
@@ -620,7 +624,7 @@
         }
         catch (Exception e)
         {
-            e.printStackTrace();
+            logger.error("Failed to retrieve user, {}: {}", username, e.getMessage());
             return;
         }
         UserCredential pwdCredential = null;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
Mon May  4 10:18:30 2009
@@ -21,9 +21,14 @@
 import java.util.Random;
 
 import org.apache.jetspeed.security.mfa.SecurityQuestionBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class QuestionFactory 
 {
+    
+    static final Logger logger = LoggerFactory.getLogger(QuestionFactory.class);
+    
 	static private Random rand;
 	
 	private List<String> questions;
@@ -47,8 +52,7 @@
         }
         catch (Throwable e)
         {
-        	System.err.println( "Unable to parse random questions: " + e.toString() );
-        	e.printStackTrace();
+        	logger.error( "Unable to parse random questions: {}", e.toString());
         }
 	}
 	

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml?rev=771261&r1=771260&r2=771261&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
Mon May  4 10:18:30 2009
@@ -135,7 +135,8 @@
         <js:service name='GroupManager'/>    
         <js:service name='PageManager'/>    
         <js:service name='PermissionManager'/>        
-        <js:service name='PortletFactory'/>        
+        <js:service name='PortletFactory'/>
+        <js:service name='PortletPreferencesProvider'/>        
         <js:service name='PortalAdministration'/>
         <js:service name='PortletRegistryComponent'/>
         <js:service name='PortalStatistics'/>        



---------------------------------------------------------------------
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