You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Mike Oliver <ol...@matrix-media.com> on 2003/12/02 15:28:07 UTC
"Please, email to slide-user@jakarta.apache.org"
Ok I do what I am told...;-)
situation: I was using the Slide Client v 2.0 to navigate my Slide
namespace AJCS.
My Application had done a mkcol of
/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem and put
some resources there.
When I tried to cd to that collection, I got the "Warning: Not found the
path", Not Jedi Knight I am...;-)...see below.
[LOCALHOST] /AJCS/ $ cd files
[LOCALHOST] /AJCS/files/ $ cd AJCSData
[LOCALHOST] /AJCS/files/AJCSData/ $ cd
com.ajcs.registries.AJCSDStoreRegistryItem
Warning: Not found the path
//so I tried
[LOCALHOST] /AJCS/files/AJCSData/ $ cd
/AJCS/files/AJCSData/com%2Eajcs%2Eregistries%2EAJCSDStoreRegistryItem/
Fatal Error: unexpected char: %
antlr.TokenStreamRecognitionException: unexpected char: %
at org.apache.webdav.cmd.ClientLexer.nextToken(ClientLexer.java:249)
at antlr.TokenBuffer.fill(TokenBuffer.java:61)
at antlr.TokenBuffer.LA(TokenBuffer.java:70)
at antlr.LLkParser.LA(LLkParser.java:50)
at antlr.Parser.match(Parser.java:179)
at org.apache.webdav.cmd.ClientParser.cd(ClientParser.java:974)
at org.apache.webdav.cmd.ClientParser.command(ClientParser.java:317)
at org.apache.webdav.cmd.ClientParser.commands(ClientParser.java:210)
at org.apache.webdav.cmd.Client.run(Client.java:149)
at org.apache.webdav.cmd.Slide.main(Slide.java:124)
Please, email to slide-user@jakarta.apache.org
So I ran the debugger on a Slide Client session and found the problem as
follows. (not the character exception above, that is just a result of my
attempt to cd to a collection that I know exists.)
In WebdavResource that follows here are the values //name=value as I
step through and you will see that it is doing a compare of an escaped
value to an unescaped value so it will always fail when there are any
escaped characters. The test of if (!href.startsWith("/")) will always
be false as the href is always normalized before it gets there, see below.
command being processed: [LOCALHOST] /AJCS/files/AJCSData/ $ cd
com.ajcs.registries.AJCSDStoreRegistryItem
protected void setWebdavProperties(Enumeration responses)
throws HttpException, IOException {
// Make the resources in the collection empty.
childResources.removeAll();
while (responses.hasMoreElements()) {
ResponseEntity response =
(ResponseEntity) responses.nextElement();
boolean itself = false;
String href = response.getHref();
//href=/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem
if (!href.startsWith("/"))
href = HttpURL.getEscapedPath(href);
//href=/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem
String httpURLPath = httpURL.getEscapedPath();
//httpURLPath=/AJCS/files/AJCSData/com%2Eajcs%2Eregistries%2EAJCSDStoreRegistryItem/
int compared = httpURLPath.compareTo(href);
//compared=-9
// Compare with the href path and requested-path itself.
if (compared == 0 || compared == -1 && href.endsWith("/") ||
compared == 1 && httpURLPath.endsWith("/")) {
// Set the status code for this resource.
if (response.getStatusCode() > 0)
setStatusCode(response.getStatusCode());
setExistence(true);
itself = true;
}
I believe that the compareTo should be either escaped to escaped or
unescaped to unescaped so the test for "if (!href.startsWith("/"))"
should be removed. I also noticed and aberation in the servlet display
on this collection where even though other collections show ACLs and
Locks in the display, this one and others like it with escaped
characters in the path, do not (already reported to this list)....I will
remove the test and verify but I suspect it to be the same problem.
Ollie
BTW "fatal error" on an unexpected character....what's up with that? but
that's another patch.
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: "Please, email to slide-user@jakarta.apache.org" not so fast
bucco
Posted by Mike Oliver <ol...@matrix-media.com>.
Object Oriented Programmer Syndrome, aka OOPS.
I assumed that HttpURL.getEscapedPath(href) == httpURL.getEscapedPath()
and it DOES NOT...ARG!
HttpURL.getEscapedPath(href) =
/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem
while
httpURL.getEscapedPath() =
/AJCS/files/AJCSData/com%2Eajcs%2Eregistries%2EAJCSDStoreRegistryItem/
go figure. Ok, so we want to compare apples to apples, so I changed
httpURL.getEscapedPath() to httpURL.getPath() and now the comparison is
unescaped to unescaped and it allows me to cd to my collection.
Now what was it my mother told me about ASSUME?
Ollie
Mike Oliver wrote:
> Ok I do what I am told...;-)
>
> situation: I was using the Slide Client v 2.0 to navigate my Slide
> namespace AJCS.
>
> My Application had done a mkcol of
> /AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem and
> put some resources there.
>
> When I tried to cd to that collection, I got the "Warning: Not found
> the path", Not Jedi Knight I am...;-)...see below.
>
> [LOCALHOST] /AJCS/ $ cd files
> [LOCALHOST] /AJCS/files/ $ cd AJCSData
> [LOCALHOST] /AJCS/files/AJCSData/ $ cd
> com.ajcs.registries.AJCSDStoreRegistryItem
> Warning: Not found the path
> //so I tried
> [LOCALHOST] /AJCS/files/AJCSData/ $ cd
> /AJCS/files/AJCSData/com%2Eajcs%2Eregistries%2EAJCSDStoreRegistryItem/
> Fatal Error: unexpected char: %
> antlr.TokenStreamRecognitionException: unexpected char: %
> at org.apache.webdav.cmd.ClientLexer.nextToken(ClientLexer.java:249)
> at antlr.TokenBuffer.fill(TokenBuffer.java:61)
> at antlr.TokenBuffer.LA(TokenBuffer.java:70)
> at antlr.LLkParser.LA(LLkParser.java:50)
> at antlr.Parser.match(Parser.java:179)
> at org.apache.webdav.cmd.ClientParser.cd(ClientParser.java:974)
> at org.apache.webdav.cmd.ClientParser.command(ClientParser.java:317)
> at org.apache.webdav.cmd.ClientParser.commands(ClientParser.java:210)
> at org.apache.webdav.cmd.Client.run(Client.java:149)
> at org.apache.webdav.cmd.Slide.main(Slide.java:124)
> Please, email to slide-user@jakarta.apache.org
>
> So I ran the debugger on a Slide Client session and found the problem
> as follows. (not the character exception above, that is just a result
> of my attempt to cd to a collection that I know exists.)
>
> In WebdavResource that follows here are the values //name=value as I
> step through and you will see that it is doing a compare of an escaped
> value to an unescaped value so it will always fail when there are any
> escaped characters. The test of if (!href.startsWith("/")) will
> always be false as the href is always normalized before it gets there,
> see below.
> command being processed: [LOCALHOST] /AJCS/files/AJCSData/
> $ cd com.ajcs.registries.AJCSDStoreRegistryItem
>
> protected void setWebdavProperties(Enumeration responses)
> throws HttpException, IOException {
>
> // Make the resources in the collection empty.
> childResources.removeAll();
> while (responses.hasMoreElements()) {
>
> ResponseEntity response =
> (ResponseEntity) responses.nextElement();
>
> boolean itself = false;
> String href = response.getHref();
>
> //href=/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem
> if (!href.startsWith("/"))
> href = HttpURL.getEscapedPath(href);
>
> //href=/AJCS/files/AJCSData/com.ajcs.registries.AJCSDStoreRegistryItem
> String httpURLPath = httpURL.getEscapedPath();
>
> //httpURLPath=/AJCS/files/AJCSData/com%2Eajcs%2Eregistries%2EAJCSDStoreRegistryItem/
>
> int compared = httpURLPath.compareTo(href);
> //compared=-9
> // Compare with the href path and requested-path itself.
> if (compared == 0 || compared == -1 && href.endsWith("/") ||
> compared == 1 && httpURLPath.endsWith("/")) {
> // Set the status code for this resource.
> if (response.getStatusCode() > 0)
> setStatusCode(response.getStatusCode());
> setExistence(true);
> itself = true;
> }
>
> I believe that the compareTo should be either escaped to escaped or
> unescaped to unescaped so the test for "if (!href.startsWith("/"))"
> should be removed. I also noticed and aberation in the servlet
> display on this collection where even though other collections show
> ACLs and Locks in the display, this one and others like it with
> escaped characters in the path, do not (already reported to this
> list)....I will remove the test and verify but I suspect it to be the
> same problem.
>
> Ollie
>
>
> BTW "fatal error" on an unexpected character....what's up with that?
> but that's another patch.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org