Author: vkumar
Date: Wed Mar 25 09:53:59 2009
New Revision: 758194

URL: http://svn.apache.org/viewvc?rev=758194&view=rev
Log:
fixing Import psml by using Internet Explorer
https://issues.apache.org/jira/browse/JS2-940

Modified:
    
portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java

Modified: 
portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java?rev=758194&r1=758193&r2=758194&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
 (original)
+++ 
portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
 Wed Mar 25 09:53:59 2009
@@ -233,12 +233,14 @@
                         if (fileItem.getFieldName().equals("psmlFile")) {
                             synchronized (this) {
                                 fileName = fileItem.getName();
+                                int lastPathSeparatorIndex = 
Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\'));
+                                if (lastPathSeparatorIndex!=-1)
+                                    fileName = 
fileName.substring(lastPathSeparatorIndex + 1);
+                                
                                 usrFolder = getTempFolder(request);
                                 path= System.getProperty("file.separator");
-                                String filePath = usrFolder + path + 
fileItem.getName();
-                                FileOutputStream out = new 
FileOutputStream(filePath);
-                                out.write(fileItem.get());
-                                out.close();
+                                String filePath = usrFolder + path + fileName;
+                                fileItem.write(new File(filePath));
                             }
                         }else if(fileItem.isFormField() && 
fileItem.getFieldName().equalsIgnoreCase("importPath")){
                             destPath= fileItem.getString();
@@ -271,6 +273,7 @@
                     
request.getPortletSession().setAttribute("status","false"); 
                  }
             } catch (Exception e) {
+                e.printStackTrace();
                 request.getPortletSession().setAttribute("status","false");
                 //throw new PortletException("Error occured in file uplodad");
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to