[ 
https://issues.apache.org/jira/browse/XERCESC-1826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Cantor reopened XERCESC-1826:
-----------------------------------

> XMLURL::makeNewStream() fails to decode file:/// URLs containing the 
> (properly escaped) % character
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1826
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1826
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5.0, 2.6.0, 2.7.0, 2.8.0, 3.0.0, 3.1.0
>         Environment: Windows XP Prof. German, MS Visual Studio 2003
>            Reporter: Matteo Ceruti
>            Assignee: Boris Kolpackov
>            Priority: Major
>             Fix For: 3.1.0
>
>
> I truly believe that XMLURL::makeNewStream() (see 
> src/xercesc/util/XMLURL.cpp) does not correctly handle file:///-URLs 
> containing the escape-sequence %25 (that is the '%'-character itself). 
> Consider you have a win32 filepath like "C:\Documents\myfile_%_.xml" . Its 
> URL would be "file:///C:/Documents/myfile_%25_.xml", right? But this URL is 
> rejected by raising a MalformedURLException.
> makeNewStream() decodes the URL by searching and replacing the 
> escape-sequences one by one. When it sucessfully replaced %25 by the 
> '%'-character it continunes it's search for the next escape-sequence. The 
> problem is, that it starts at the very position, where the last 
> escape-sequence began. Therefore it suddenly finds a %-character again, 
> because it had just been put there.
> This happens at least with xerces-c 2.5 and it seems that the current 
> (revision=670359) 
> http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLURL.cpp still 
> has this problem. So probably other releases may have the same issue.
> I think the line
>  percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex, 
> fMemoryManager);
> should be replaced by 
>  percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex + 1, 
> fMemoryManager);
> This works for me.
> Please correct me, if I'm wrong. Thank you in advance.
> Best regards,
>  Matteo



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to