Arguable bug in PrevaylerDirectory

Karl Wettin <[email protected]>
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
Hi fora,

PrevaylerDirectory row 99 is:

		long latestVersion = 0;

I claim this is a bug, that it should be -1:

		File latestSnapshot = null;
		long latestVersion = -1;
		for (int i = 0; i < files.length; i++) {
			File candidateSnapshot = files[i];
			long candidateVersion = snapshotVersion(candidateSnapshot);
			if (candidateVersion > latestVersion) {
				latestVersion = candidateVersion;
				latestSnapshot = candidateSnapshot;
			}
		}

One could argue that version 0 never would exist, but I say it might.  
In my case I've been migrating my data from an old system to Prevayler  
without using transactions, just raw access to my root object. Taking  
a snapshot will produce version 0. With latestVersion initialized as 0  
this snapshot will not be loaded.


        karl


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.