You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2008/10/17 14:14:41 UTC

svn commit: r705577 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade: components/jetspeed-portal/pom.xml components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java pom.xml

Author: woonsan
Date: Fri Oct 17 05:14:40 2008
New Revision: 705577

URL: http://svn.apache.org/viewvc?rev=705577&view=rev
Log:
Fixed userName retrieving bug, which also broke Export admin portlet.

Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/pom.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/pom.xml?rev=705577&r1=705576&r2=705577&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/pom.xml Fri Oct 17 05:14:40 2008
@@ -115,6 +115,10 @@
             <artifactId>commons-collections</artifactId>
         </dependency>
         <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+        <dependency>
             <groupId>javax.mail</groupId>
             <artifactId>mail</artifactId>
         </dependency>

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java?rev=705577&r1=705576&r2=705577&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java Fri Oct 17 05:14:40 2008
@@ -17,9 +17,11 @@
 package org.apache.jetspeed.layout.impl;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.JetspeedActions;
@@ -70,7 +72,7 @@
     {
         boolean success = true;
         String status = "success";
-        String userName = requestContext.getUserPrincipal().toString();
+        String userName = requestContext.getUserPrincipal().getName();
         Map settings = new HashMap();
         String exportFileName = getUserFolder(userName, false) + pathSeprator + "ldapExport.xml";
         try
@@ -147,40 +149,35 @@
     private boolean cleanUserFolder(String userName)
     {
         boolean success = false;
+        
         synchronized (this)
         {
+            File zipFile = new File(pageRoot + pathSeprator + userName + ".zip");
+            
+            if (zipFile.isFile())
+                zipFile.delete();
+            
             String folder = getUserFolder(userName, false);
-            File dir = new File(pageRoot + pathSeprator + userName + ".zip");
-            if (dir.exists())
-                dir.delete();
-            dir = new File(folder);
-            if (dir.exists())
+            File dir = new File(folder);
+            
+            if (dir.isDirectory())
             {
-                success = deleteDir(dir);
-            }
-            success = dir.mkdir();
-        }
-        return success;
-    }
-
-    private boolean deleteDir(File dir)
-    {
-        if (dir.exists())
-        {
-            File[] files = dir.listFiles();
-            for (int i = 0; i < files.length; i++)
-            {
-                if (files[i].isDirectory())
+                try
                 {
-                    deleteDir(files[i]);
+                    FileUtils.cleanDirectory(dir);
+                    success = true;
                 }
-                else
+                catch (IOException e)
                 {
-                    files[i].delete();
                 }
             }
+            else
+            {
+                success = dir.mkdir();
+            }
         }
-        return (dir.delete());
+        
+        return success;
     }
 
     private String getUserFolder(String userName, boolean fullPath)

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml?rev=705577&r1=705576&r2=705577&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/pom.xml Fri Oct 17 05:14:40 2008
@@ -279,7 +279,7 @@
     <commons-digester.version>1.8</commons-digester.version>
     <commons-fileupload.version>1.2</commons-fileupload.version>
     <commons-httpclient.version>3.0.1</commons-httpclient.version>
-    <commons-io.version>1.3.1</commons-io.version>
+    <commons-io.version>1.3.2</commons-io.version>
     <commons-lang.version>2.1</commons-lang.version>
     <commons-logging.version>1.1</commons-logging.version>
     <commons-pool.version>1.3</commons-pool.version>



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