oh but then it is is pretty simple
I will remove the replace . with / completely there.
And that must be done from the outside so all paths must be real paths..

johan


Gili wrote:


Are you saying that the implementation is trying to elicit who invoked the current method and depending on the caller we implement different behavior? What happens if a new caller is added in the future?

Look, I'm not trying to bust your chops here. I just get uncomfortable with this code. If possible, we should improve it to be more explicit about why it's doing what it's doing (adding comments would help) and ideally not make guesses about the method caller -- instead we should operate deterministically based upon the content.

At the very least, I would add an assert() or two to validate that our assumptions about the value of path are correct so if it changes in the future we'd catch it.

Gili

Johan Compagner wrote:



Gili wrote:


    Right, but your code says:

- Search for a slash in "path"
- If no slashes are found, replace all dots by slashes; otherwise replace nothing.

This does not make sense to me. Nowhere in your code are you splitting path into the two components you mention (class.getName() and staticResource.absolutePath) and handle them separately. We should be replacing all dots in class.getName() by slashes and leaving the other component alone. No?



That is what i am doing now..
As i said if the call comes from a getName() then there are dots instead of slashes.
if the call comes from a staticResource we should't convert it.



Gili

Johan Compagner wrote:

No as far as i can see in the code there are 2 things that go into that.
class.getName() or staticResources.absoluutPath

the first one will always be . only
and the second one will only be / only (except what is in the filename)



Gili wrote:


    I'm not sure whether this patch is correct.

If I remember correctly, we want to convert dots to slashes in the path (excluding the filename) because that part of the path is derived from the resource "scope" which is a Java package name (dots).

So I think what happens is that we want to convert the scope (package name) into slashes like we were already doing but don't touch the filename component. What do you think?

Gili

Johan Compagner wrote:

Update of /cvsroot/wicket/wicket/src/java/wicket/util/resource/locator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5918/src/java/wicket/util/resource/locator

Modified Files:
    ResourceStreamLocator.java Log Message:
only change . to / if there are no / found in the path
(so normal file paths are not again converted)

Index: ResourceStreamLocator.java
===================================================================
RCS file: /cvsroot/wicket/wicket/src/java/wicket/util/resource/locator/ResourceStreamLocator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ResourceStreamLocator.java    8 Apr 2005 06:09:08 -0000    1.2
--- ResourceStreamLocator.java    30 May 2005 21:14:39 -0000    1.3
***************
*** 120,125 ****
              }
          }
! return locator.locate(path.replace('.', '/'), style, locale, extensionString);
      }
  }
--- 120,130 ----
              }
          }
+         int index = path.indexOf("/");
+         if(index == -1)
+         {
+             path = path.replace('.', '/');
+         }
! return locator.locate(path, style, locale, extensionString);
      }
  }



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-autocvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-autocvs




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to