From: Wolfgang M. M. <wol...@us...> - 2004-03-29 14:27:16
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31676/src/org/exist/collections Modified Files: Collection.java Log Message: * Fixed stability issues: collection pointers got corrupted occasionally, resulting in ArrayIndexOutOfBoundsExceptions. * Added check for file format versions: the database will throw an exception if the database files are incompatible with the current eXist version. Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Collection.java 3 Feb 2004 09:10:11 -0000 1.18 --- Collection.java 29 Mar 2004 14:15:11 -0000 1.19 *************** *** 65,69 **** import org.exist.util.VariableByteInputStream; import org.exist.util.VariableByteOutputStream; ! import org.exist.util.hashtable.Object2LongHashMap; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; --- 65,69 ---- import org.exist.util.VariableByteInputStream; import org.exist.util.VariableByteOutputStream; ! import org.exist.util.hashtable.ObjectHashSet; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; *************** *** 108,112 **** // stores child-collections with their storage address ! private Object2LongHashMap subcollections = new Object2LongHashMap(19); // temporary field for the storage address --- 108,112 ---- // stores child-collections with their storage address ! private ObjectHashSet subcollections = new ObjectHashSet(19); // temporary field for the storage address *************** *** 142,147 **** final int p = child.name.lastIndexOf('/') + 1; final String childName = child.name.substring(p); ! if (!subcollections.containsKey(childName)) ! subcollections.put(childName, child.address); } --- 142,147 ---- final int p = child.name.lastIndexOf('/') + 1; final String childName = child.name.substring(p); ! if (!subcollections.contains(childName)) ! subcollections.add(childName); } *************** *** 155,159 **** final String childName = child.name.substring(p); subcollections.remove(childName); ! subcollections.put(childName, child.address); } --- 155,159 ---- final String childName = child.name.substring(p); subcollections.remove(childName); ! subcollections.add(childName); } *************** *** 247,256 **** for (Iterator i = subcollections.iterator(); i.hasNext(); ) { childName = (String) i.next(); ! addr = subcollections.get(childName); ! if (addr < 0) ! child = broker.getCollection(name + '/' + childName); ! else ! child = broker.getCollection(name + '/' + childName, addr); ! if (permissions.validate(broker.getUser(), Permission.READ)) { child.getDocuments(docs); if (child.getChildCollectionCount() > 0) --- 247,254 ---- for (Iterator i = subcollections.iterator(); i.hasNext(); ) { childName = (String) i.next(); ! child = broker.getCollection(name + '/' + childName); ! if(child == null) { ! LOG.warn("child collection " + childName + " not found. Skipping ..."); ! } else if (permissions.validate(broker.getUser(), Permission.READ)) { child.getDocuments(docs); if (child.getChildCollectionCount() > 0) *************** *** 444,451 **** try { lock.acquire(Lock.READ_LOCK); ! return subcollections.containsKey(name); } catch (LockException e) { LOG.warn(e.getMessage(), e); ! return subcollections.containsKey(name); } finally { lock.release(); --- 442,449 ---- try { lock.acquire(Lock.READ_LOCK); ! return subcollections.contains(name); } catch (LockException e) { LOG.warn(e.getMessage(), e); ! return subcollections.contains(name); } finally { lock.release(); *************** *** 474,480 **** final int collLen = istream.readInt(); String sub; ! subcollections = new Object2LongHashMap(collLen); for (int i = 0; i < collLen; i++) ! subcollections.put(istream.readUTF(), istream.readLong()); final SecurityManager secman = broker.getBrokerPool() --- 472,478 ---- final int collLen = istream.readInt(); String sub; ! subcollections = new ObjectHashSet(collLen); for (int i = 0; i < collLen; i++) ! subcollections.add(istream.readUTF()); final SecurityManager secman = broker.getBrokerPool() *************** *** 1230,1234 **** childColl = (String) i.next(); ostream.writeUTF(childColl); - ostream.writeLong(subcollections.get(childColl)); } org.exist.security.SecurityManager secman = broker.getBrokerPool() --- 1228,1231 ---- *************** *** 1283,1286 **** --- 1280,1287 ---- } + public long getAddress() { + return this.address; + } + public void setCreationTime(long ms) { created = ms; |