...same patches attached to avoid line wrapping...
Randy Watler
rwatler wrote:
John/Scott:
The patch below for o/a/j/page/impl/CastorXmlPageManager.java worked
for me... it seems that page ids now require an extension so that they
can be cached correctly in the FileCache with a real file name. I am
not sure this is the CORRECT fix. It is certainly not the cleanest or
most efficient possible... perhaps adding an additional name/alias
lookup to the FileCache would be better?
I also had to escape the French LATIN-1 character embedded in the
o/a/j/page/TestCastorXmlPageManager.java source file to make sure it
functioned properly. I seem to recall somewhere that LATIN-1
characters must be escaped in string literals, (?).
Randy Watler
--- CastorXmlPageManager.java.orig 2004-08-30 21:37:13.000000000 -0600
+++ CastorXmlPageManager.java 2004-08-30 20:44:43.000000000 -0600
@@ -194,7 +194,14 @@
Page page = null;
- page = (Page) pages.getDocument(id);
+ if (id.endsWith(this.ext))
+ {
+ page = (Page) pages.getDocument(id);
+ }
+ else
+ {
+ page = (Page) pages.getDocument(id + this.ext);
+ }
if (page == null)
{
@@ -206,7 +213,14 @@
// watcher
try
{
- pages.put(id, page, this.rootDir);
+ if (id.endsWith(this.ext))
+ {
+ pages.put(id, page, this.rootDir);
+ }
+ else
+ {
+ pages.put(id + this.ext, page, this.rootDir);
+ }
int lastSlash = id.indexOf("/");
if (lastSlash > -1)
{
@@ -385,7 +399,16 @@
}
// marshal page to disk
- File f = new File(this.rootDir, id + this.ext);
+
+ File f = null;
+ if (id.endsWith(this.ext))
+ {
+ f = new File(this.rootDir, id);
+ }
+ else
+ {
+ f = new File(this.rootDir, id + this.ext);
+ }
FileWriter writer = null;
try
@@ -437,7 +460,14 @@
{
try
{
- pages.put(id, page, this.rootDir);
+ if (id.endsWith(this.ext))
+ {
+ pages.put(id, page, this.rootDir);
+ }
+ else
+ {
+ pages.put(id + this.ext, page, this.rootDir);
+ }
}
catch (IOException e)
{
@@ -467,11 +497,26 @@
return;
}
- File file = new File(this.rootDir, id + this.ext);
+ File file = null;
+ if (id.endsWith(this.ext))
+ {
+ file = new File(this.rootDir, id);
+ }
+ else
+ {
+ file = new File(this.rootDir, id + this.ext);
+ }
synchronized (pages)
{
- pages.remove(id);
+ if (id.endsWith(this.ext))
+ {
+ pages.remove(id);
+ }
+ else
+ {
+ pages.remove(id + this.ext);
+ }
}
file.delete();
--- TestCastorXmlPageManager.java.orig 2004-08-30 21:21:44.000000000 -0600
+++ TestCastorXmlPageManager.java 2004-08-30 21:22:26.000000000 -0600
@@ -346,7 +346,7 @@
Folder folder1French = pageManager.getFolder("folder1");
FolderMetaData metaData = folder1French.getMetaData();
assertNotNull(metaData);
- assertEquals("Titre français pour la chemise 1",
metaData.getTitle(Locale.FRENCH));
+ assertEquals("Titre fran\347ais pour la chemise 1",
metaData.getTitle(Locale.FRENCH));
Folder folder1English = pageManager.getFolder("folder1");
metaData = folder1English.getMetaData();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]