Michael Ralston wrote:

I fixed the problem.

javax.xml.DocumentParser wasn't closing the inputstream, so I called DocumentParser with my own input stream and then closed it myself. See patch.

another question re your patch: Why did you change the sequence re
deleting from SiteStructure and  DocumentSource?

Thanks

Michi

Michael Ralston


On Tuesday 11 October 2005 16:17, Michael Ralston wrote:
I'm having a problem with Lenya running on Windows.

When I attempt to deactivate a document, Lenya gives me the following
exception...

47   2005-10-11 16:07:09,765 [PoolThread-4] ERROR
org.apache.lenya.cms.task.TaskSequence.execute():140  - Cannot execute
TaskSequence:
org.apache.lenya.cms.task.ExecutionException:
org.apache.lenya.cms.publication.PublicationException: Source file [Y:
\Java\apache-lenya-1.2.4-src\build\lenya\webapp\lenya\pubs\default\content\
live\concepts\index_en.xml] of document [default:live:/concepts:en] could
not be deleted!
       at
org.apache.lenya.defaultpub.cms.task.Deactivate.execute(Deactivate.java:75)


I checked org.apache.lenya.cms.publication.file.FilePublication and the
method deleteDocumentSource is where this exception originates.

I have run this through a debugger and suspended execution when it reaches
the deleteDocumentSource method, I then opened windows explorer and
attempted to delete the file. Windows told me the file was in use and it
could not be deleted.

This error does not occur on Linux, as it allows the file to be deleted
while it is still open, it will take care of cleaning up after the file is
closed.

Is it possible somewhere in Lenya, a fileinputstream or fileoutputstream is
used but not closed?

I have tried running lenya with incremental garbage collection to attempt
to have the open file descriptor cleaned up, this didn't help either.

Is this a known problem with running lenya on windows?

Michael Ralston

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------

diff -Nwurd 
apache-lenya-1.2.4-orig/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
 
apache-lenya-1.2.4-src/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
--- 
apache-lenya-1.2.4-orig/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
  2005-06-26 10:52:32.000000000 +1000
+++ 
apache-lenya-1.2.4-src/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
   2005-10-11 17:35:22.268846832 +1000
@@ -530,8 +530,8 @@
        if (!document.exists()) {
            throw new PublicationException("Document [" + document + "] does not 
exist!");
        }
-        deleteFromSiteStructure(document);
        deleteDocumentSource(document);
+        deleteFromSiteStructure(document);
    }

    /**
diff -Nwurd 
apache-lenya-1.2.4-orig/src/java/org/apache/lenya/xml/DocumentHelper.java 
apache-lenya-1.2.4-src/src/java/org/apache/lenya/xml/DocumentHelper.java
--- apache-lenya-1.2.4-orig/src/java/org/apache/lenya/xml/DocumentHelper.java   
2005-06-26 10:52:33.000000000 +1000
+++ apache-lenya-1.2.4-src/src/java/org/apache/lenya/xml/DocumentHelper.java    
2005-10-11 17:35:32.884233048 +1000
@@ -20,6 +20,7 @@
package org.apache.lenya.xml;

import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
@@ -47,6 +48,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;


@@ -115,8 +117,10 @@
     */
    public static Document readDocument(File file)
        throws ParserConfigurationException, SAXException, IOException {
-        DocumentBuilder builder = createBuilder();
-        return builder.parse(file);
+        FileInputStream inStream=new FileInputStream(file);
+        Document result=readDocument(inStream);
+        inStream.close();
+        return result;
    }

    /**

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
[EMAIL PROTECTED]                        [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to