https://issues.apache.org/bugzilla/show_bug.cgi?id=45490





--- Comment #4 from Thomas S. <[EMAIL PROTECTED]>  2008-08-04 11:17:29 PST ---
Hi Andreas,

I'm no sure if I understand the difference between your suggestion and mine.

So I decided to paste the full source and the suggested changes (as far
as I did understand them) here!

Here's the original implementation:

 if (href.startsWith(scheme)) {
   href = href.substring(scheme.length());
   if ("file:".equals(scheme)) {
     int colonPos = href.indexOf(':');
     int slashPos = href.indexOf('/');
     if (slashPos >= 0 && colonPos >= && colonPos < slashPos) {
       href = "/" + href; // Absolute file URL doesn't have a leading slash
     }
   }
 }

If I understand your comment #3, the result of the scheme removal should 
go to a temporary var. The check for colon and slash index will be made
on this variable, right? And then, depending on the last condition, a
leading slash will be added, ok?

 if (href.startsWith(scheme)) {
   String tmp = href.substring(scheme.length());
   if ("file:".equals(scheme)) {
     int colonPos = tmp.indexOf(':');
     int slashPos = tmp.indexOf('/');
     if (slashPos >= 0 && colonPos >= && colonPos < slashPos) {
       href = "/" + tmp; // Absolute file URL doesn't have a leading slash
     }
   }
 }

But if I'm right here, I see no difference between my suggestion and yours?

That's mine:

 if (href.startsWith(scheme) && "file:".equals(scheme)) {
   int colonPos = tmp.indexOf(':');
   int slashPos = tmp.indexOf('/');
   if (slashPos >= 0 && colonPos >= && colonPos < slashPos) {
     href = "/" + tmp; // Absolute file URL doesn't have a leading slash
   }
 }

Help me out of my ignorance :-)!


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to