You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/05/02 14:47:14 UTC
svn commit: r534432 -
/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
Author: andreas
Date: Wed May 2 05:47:13 2007
New Revision: 534432
URL: http://svn.apache.org/viewvc?view=rev&rev=534432
Log:
Don't write an empty RCML file if not necessary. This fixes bug 42316.
Modified:
lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java?view=diff&rev=534432&r1=534431&r2=534432
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java Wed May 2 05:47:13 2007
@@ -80,11 +80,6 @@
this.node = node;
this.manager = manager;
- if (!SourceUtil.exists(getRcmlSourceUri(), manager)) {
- // The rcml file does not yet exist, so we create it now
- initDocument();
- write();
- }
}
protected static final String RCML_EXTENSION = ".rcml";
@@ -94,14 +89,6 @@
}
/**
- * initialise the RCML-document. Delete all entries
- * @throws ParserConfigurationException
- */
- public void initDocument() throws ParserConfigurationException {
- this.xml = DocumentHelper.createDocument(null, "XPSRevisionControl", null);
- }
-
- /**
* Call the methode write, if the document is dirty
*
* @throws IOException if an error occurs
@@ -139,7 +126,7 @@
*/
public void checkOutIn(short type, String identity, long time, boolean backup)
throws IOException, Exception {
-
+
Document doc = getDocument();
if (identity == null) {
@@ -203,20 +190,27 @@
write();
}
}
-
+
private long lastModified = 0;
protected Document getDocument() throws RevisionControlException {
- try {
- String uri = getRcmlSourceUri();
- long sourceLastModified = SourceUtil.getLastModified(uri, manager);
- if (this.xml == null || sourceLastModified > this.lastModified) {
- this.xml = SourceUtil.readDOM(getRcmlSourceUri(), this.manager);
- this.lastModified = sourceLastModified;
+ if (this.xml == null) {
+ try {
+ String uri = getRcmlSourceUri();
+ if (SourceUtil.exists(uri, this.manager)) {
+ long sourceLastModified = SourceUtil.getLastModified(uri, manager);
+ if (this.xml == null || sourceLastModified > this.lastModified) {
+ this.xml = SourceUtil.readDOM(getRcmlSourceUri(), this.manager);
+ this.lastModified = sourceLastModified;
+ }
+ }
+ else {
+ this.xml = DocumentHelper.createDocument(null, "XPSRevisionControl", null);
+ }
+ } catch (Exception e) {
+ throw new RevisionControlException("Could not read RC file [" + getRcmlSourceUri()
+ + "]");
}
- } catch (Exception e) {
- throw new RevisionControlException("Could not read RC file [" + getRcmlSourceUri()
- + "]");
}
return this.xml;
}
@@ -518,7 +512,8 @@
}
/**
- * Delete the revisions, the RCML source and the collection if the latter is empty.
+ * Delete the revisions, the RCML source and the collection if the latter is
+ * empty.
* @return boolean true, if the file was deleted
*/
public boolean delete() {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org