Hello all, The MRUMemoryStore.get() method is no longer retrieving items that have been cached to the filesystem. The cause is that the "CacheObject" class, defined in MRUMemoryStore.java, is no longer used. It would generate an NPE in the event that a cached object was not found in memory. It was this NPE that then forced the get() method (via try-catch block) to check the filesystem cache. This patch simply replaces the try-catch block with an if-else block. Note that this diff was made against the cocoon_20_branch CVS branch.
Index: MRUMemoryStore.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/store/MRUMemoryStore.java,v retrieving revision 1.2.2.11 diff -u -r1.2.2.11 MRUMemoryStore.java --- MRUMemoryStore.java 2001/08/22 03:16:40 1.2.2.11 +++ MRUMemoryStore.java 2001/08/23 03:26:21 @@ -288,37 +288,38 @@ getLogger().debug("Getting object from memory. Key: " + key); Object tmpobject = new Object(); - try { - /** put the accessed key on top of the linked list */ - this.mrulist.remove(key); - this.mrulist.addFirst(key); - return this.cache.get(key); - } catch(NullPointerException e) { - getLogger().debug("Object not found in memory"); - /** try to fetch from filesystem */ - if(this.filesystem) { - tmpobject = this.fsstore.get(getFileName(key.toString())); - if (tmpobject == null) { - getLogger().debug( "Object was NOT found on fs. Looked for: " + URLEncoder.encode(key.toString()) ); + /** put the accessed key on top of the linked list */ + this.mrulist.remove(key); + this.mrulist.addFirst(key); + + tmpobject = this.cache.get(key); + if ( tmpobject != null ) { + return tmpobject; + } + + getLogger().debug("Object not found in memory"); + /** try to fetch from filesystem */ + if(this.filesystem) { + tmpobject = this.fsstore.get(getFileName(key.toString())); + if (tmpobject == null) { + getLogger().debug( "Object was NOT found on fs. Looked for: " + +URLEncoder.encode(key.toString()) ); + return null; + } else { + getLogger().debug("Object was found on fs"); + try { + tmpobject = IOUtils.deserializeObject((File)tmpobject); + this.hold(key,tmpobject); + return tmpobject; + } catch (ClassNotFoundException ce) { + getLogger().error("Error in get()!",ce); return null; - } else { - getLogger().debug("Object was found on fs"); - try { - tmpobject = IOUtils.deserializeObject((File)tmpobject); - this.hold(key,tmpobject); - return tmpobject; - } catch (ClassNotFoundException ce) { - getLogger().error("Error in get()!",e); - return null; - } catch (java.io.IOException ioe) { - getLogger().error("Error in get()!",e); - return null; - } + } catch (java.io.IOException ioe) { + getLogger().error("Error in get()!",ioe); + return null; } - } else { - return null; } } + return null; } /**
Rick Tessner [EMAIL PROTECTED] MYRA Systems Corp. Fone: (250) 381 1335 x125 Phax: (250) 381 1304 Cell: (250) 885 9452 "It's not a question, but a lesson learned in time. It's something unpredictable, but in the end is right."
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]