Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

svn commit: r534432 - /lenya/trunk/src/modules/sourcerepository/java/src/or: msg#00010

cms.lenya.cvs

Subject: 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() {


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
solaris.opensol...    editors.vim/200...    web.turbogears....    jakarta.ant.dev...    mathematics.max...    text.unicode.ge...    lang.ruby.core/...    xfce.announce/2...    network.centeri...    php.cvs.pear/20...    user-groups.lin...    kde.devel.quant...    file-systems.ar...    redhat.fedora.t...    apple.fink.auto...    gnome.orbit.gen...    qplus.devel/200...    culture.transpo...    video.dri.user/...    operators.nanog...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation