|
|
Choosing A Webhost: |
svn commit: r534432 - /lenya/trunk/src/modules/sourcerepository/java/src/or: msg#00010cms.lenya.cvs
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> |
|---|---|---|
Free MagazinesCisco NewsReceive 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 |