Hi,
It seems that there really is a bug in expiration/FileWatchPortlet. Exactly
it seems to be two (different but somehow related bugs)
[Proposed fixes at the end of the mail ;)]
#1:
DiskCache does not really detect changes of local-urls (like
file:/e:\tomcat\webapps\...)
A little tweaking with JetspeedDiskcacheEntry provided a work-around for
me....
#2:
Re-Loading of expired portlets that are initialized from a local-url does
not really work .. (at least here ... probably because i'm running on NT ...
but it should show nearly the same behaviour on unix ... I could try on
linux if you want to)
On the first init of the portlet PortletConfig is given the following:
.setUrl("/jcm/jetspeed-content");
setUrl() will check if that's a "real" url and else (virtuals) pass it to
EngineContext.getResource( url ).toString(). [In this case it's detected as
virtual, which is fine]. The EngineContext now returns the "physical" URL
which is in my case
"file:e:\tomcat\webapps\jetspeed\jcm\jetspeed-content.xml". This is saved to
this.url (PortletConfig's url) ...
When the file is changed on disk and (my changed) JetspeedDiskcacheEntry
detects this, it is set to expire, resulting in a re-creation of the
content. When the portlet is recreated the following are executed:
PortletExpirationThread.run()
-> PortletFactory.getPortlet()
-> PortletConfigFactory.getPortletConfig()
-> PortletConfig.setUrl()
But now, .setUrl gets passed
"file:e:\tomcat\webapps\jetspeed\jcm\jetspeed-content.xml" (this is taken
from portlet.getPortletConfig().getUrl()) . When this is passed to
EngineContext.getResource(url).toString() two exceptions are thrown, the
first from
java.io.IOException: Die Syntax für den Dateinamen, Verzeichnisnamen oder
die Datenträgerbezeichnung ist falsch
[TRANSL.: Incorrect syntax for filename, directory or drivename]
at java.io.Win32FileSystem.canonicalize(Native Method)
at java.io.File.getCanonicalPath(File.java:437)
at org.apache.tomcat.util.FileUtil.safePath(FileUtil.java:184)
at org.apache.tomcat.core.Context.getResource(Context.java:763)
at
org.apache.tomcat.facade.ServletContextFacade.getResource(ServletContextFaca
de.java:153)
at
org.apache.jetspeed.services.enginecontext.ServletEngineContextService.getRe
source(ServletEngineContextService.java:113)
at
org.apache.jetspeed.services.enginecontext.EngineContext.getResource(EngineC
ontext.java:77)
at
org.apache.jetspeed.portal.PortletConfig.setURL(PortletConfig.java:205)
at ...
The the following entry is written to the tomcat-window
2001-01-22 08:36:23 - Ctx( /jetspeed ): Unsafe path
E:\Tomcat\webapps\jetspeed
/file:E:\Tomcat\webapps\jetspeed\jcm\jetspeed-content.xml
Right after this a nullpointer-Exception happens
at
org.apache.jetspeed.services.enginecontext.ServletEngineContextService.getRe
source(ServletEngineContextService.java:116)
Proposed fixes:
[btw. I don't really know if those patches are in a suitable format for
anybody ... it's just what wincvs outputs when I try to "diff" the file ;))
... else please tell me about the correct way to produce diffs (on W2K) and
submit patches... thanks!]
#1 is quite a change ... i don't know if it's supposed this way, or if this
should be placed somewhere else ....
#2 is quite straightforward ;)
#1
Index: JetspeedDiskCacheEntry.java
===================================================================
RCS file:
/products/cvs/jetspeed/jetspeed/src/java/org/apache/jetspeed/cache/disk/Jets
peedDiskCacheEntry.java,v
retrieving revision 1.22
diff -w -r1.22 JetspeedDiskCacheEntry.java
367c367,377
< return this.lastModified;
---
> if(DiskCacheUtils.isLocal( this.getURL() ) )
> {
> try {
> String localfile = this.getURL().substring(5); // remove
the "file:"
> long recent = new File(localfile).lastModified();
> this.lastModified = recent;
> } catch (Exception e)
> {
> // not really local file, just return the standard lastmod
> }
> }
368a379
> return this.lastModified;
#2
Index: PortletConfig.java
===================================================================
RCS file:
/products/cvs/jetspeed/jetspeed/src/java/org/apache/jetspeed/portal/PortletC
onfig.java,v
retrieving revision 1.38
diff -w -r1.38 PortletConfig.java
201c201
< if ( url.indexOf("://") < 0 ) {
---
> if ((url.indexOf("://") < 0) && (url.indexOf("file:")!=0) ) {
Bye,
Ingo
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/[email protected]/>
List Help?: [EMAIL PROTECTED]