[opencms-dev] Tell me if this makes sense...
Jonathan Woods
jonathan.woods at scintillance.com
Fri Sep 15 21:45:23 CEST 2006
No worries - I just wish I'd spotted it! This is just the kind of thing
which eats up hours of my time too. I try to learn from my mistakes, but
always seem to find new kinds to make...
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Daniel Rhoden
Sent: 15 September 2006 20:39
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Tell me if this makes sense...
There are times in my life that I have never been happier to feel like an
idiot. Your fresh perspective helped me go back and quadruple check the
destination portion of the copy process. I found that I had been glossing
over the ever-so-difficult-to-see-with-my-eyesight space in the path.
ARRRRG!
Now works perfectly.
Thank you very much for your help and encouragement.
Jonathan Woods wrote:
I can't think of a reason why xmpages and images would be treated
differently. But maybe there's some other difference: is there a difference
in the CmsResourceFilter used under the hood by readResource etc and
copyResource? Maybe the resource in question is deleted, expired etc in one
case but not in the other.
It's odd that your error message when calling ...copyResource() says "error
CREATING <some path>" - it's not saying that it can't find the source
resource, but that it can't create one. That makes reminds me of the kind
of error messages you get in various environments when trying to create a
resource in a folder which itself doesn't exist - but I don't see how that
can be the case.
Jon
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Daniel Rhoden
Sent: 15 September 2006 19:40
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Tell me if this makes sense...
Thanks Jon.
Sorry for forgetting to state the fact that I am executing this jsp from
within the Root site ( / ) and not a site itself.
But you are correct that I would have to have the source = "/myImage.jpg" if
I were in the "mySite" site. I would assume if the ob.existsResource()
method see the file (returns true) then the copyResource should see it just
as well (my assumption).
What is odd is how I have used my generic copy-a-resource.jsp to copy other
resources and they worked just fine. I haven't been able to identify the
differences between the circumstances of when it worked and now. Would the
fact that I am copying an image and not an xmlpage be the problem?
Jonathan Woods wrote:
The API is sometimes a bit inconsistent about the meaning of 'resource name'
or 'resource path' in method signatures: sometimes it's relative to the site
root, and sometimes it's absolute. Are you sure you are using the right
variant for CmsObject.copyResource()? I've not used the method, but I
imagine it takes a site-root-relative value.. yet your symbol 'source' is
absolute. Try using the relative equivalent and see if that helps.
Jon
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Daniel Rhoden
Sent: 15 September 2006 19:11
To: The OpenCms mailing list
Subject: [opencms-dev] Tell me if this makes sense...
I am trying to copy a large number of files by writing a jsp that uses
CmsObject.copyResource(). Now tell me if this makes sense to you:
(assume ob is an instance of CmsObject and source =
"/sites/mySite/myImage.jpg")
1. When I do ob.existsResource(source) it returns true.
2. I can even CmsResource rec = ob.readResource(source), and
source.equals(rec.getRootPath() ).
3. Looks good, right?
But when I try to ob.copyResource(source, destination), I get the following
exception:
org.opencms.file.CmsVfsResourceNotFoundException: Error creating the
resource "/sites/mySite/myImage.jpg"
Not Found??? Not Found?? Then what the heck was it doing with those
previous calls??
My installed OpenCms version is: 6.2.0
Running on Sun Microsystems Inc. Java HotSpot(TM) Client VM 1.5.0_07-b03
mixed mode, sharing with Linux 2.6.9-34.EL (i386)
MySql
_____
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
_____
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060915/5268dc12/attachment.htm>
More information about the opencms-dev
mailing list