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 ra...@apache.org on 2003/03/02 16:45:08 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager CastorPsmlManagerService.java

raphael     2003/03/02 07:45:08

  Modified:    src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
  Log:
  Fix for bug 16112 - Infinite loop in PSMLManager creats StackOverflow
  
  thanks to <ca...@hotmail.com> for the patch
  
  Revision  Changes    Path
  1.36      +18 -34    jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
  
  Index: CastorPsmlManagerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- CastorPsmlManagerService.java	14 Nov 2002 06:52:37 -0000	1.35
  +++ CastorPsmlManagerService.java	2 Mar 2003 15:45:08 -0000	1.36
  @@ -55,7 +55,6 @@
   package org.apache.jetspeed.services.psmlmanager;
   
   //Jetspeed stuff
  -import org.apache.jetspeed.cache.disk.JetspeedDiskCache;
   import org.apache.jetspeed.om.profile.ProfileLocator;
   import org.apache.jetspeed.om.profile.QueryLocator;
   import org.apache.jetspeed.util.FileCopy;
  @@ -130,7 +129,7 @@
    * @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
    * @version $Id$
    */
  -public class CastorPsmlManagerService extends TurbineBaseService 
  +public class CastorPsmlManagerService extends TurbineBaseService
                                         implements FileCacheEventListener,
                                                    PsmlManagerService
   {
  @@ -636,7 +635,6 @@
           if (portlets != null)
           {
               Serializer serializer = new XMLSerializer(writer, format);
  -//            portlets.marshal(serializer.asDocumentHandler());
               Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
               marshaller.setMapping(this.mapping);
               marshaller.marshal(portlets);
  @@ -660,35 +658,7 @@
           {
               return f;
           }
  -/*
  -        else
  -        {
  -            // try as a relative path
  -            String path = TurbineServlet.getRealPath(fileOrUrl);
  -            if (null == path)
  -            {
  -                path = fileOrUrl;
  -            }
  -
  -            f = new File(path);
  -            if (f.exists())
  -            {
  -                return f;
  -            }
  -
  -            // try through the disk cache
  -            try
  -            {
  -                f = JetspeedDiskCache.getInstance().getEntry(fileOrUrl).getFile();
  -            }
  -            catch (Exception e)
  -            {
  -                Log.error("PSMLManager: unabel to retrieve file from diskcache for "+fileOrUrl,e);
  -            }
   
  -        }
  -        return f;
  -*/
           return null;
       }
   
  @@ -1546,11 +1516,25 @@
        */
       public void refresh(FileCacheEntry entry)
       {
  -        System.out.println("entry is refreshing: " + entry.getFile().getName());
  +        if (Log.getLogger().isInfoEnabled())
  +        {
  +            Log.info("CastorPsmlManager: Entry is refreshing: " + entry.getFile().getPath());
  +        }
  +
           Profile profile = (Profile) entry.getDocument();
  +        String path = null;
  +
           if (profile != null)
           {
  -            profile.setDocument(loadDocument(entry.getFile().getName()));
  +            try
  +            {
  +                path = entry.getFile().getCanonicalPath();
  +                profile.setDocument(loadDocument(path));
  +            }
  +            catch(java.io.IOException e)
  +            {
  +                Log.error("CastorPsmlManager: Failed to refresh document "+path);
  +            }
           }
       }
   
  
  
  

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