You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Youssouf Mhoma (JIRA)" <xm...@xml.apache.org> on 2010/02/25 17:16:28 UTC
[jira] Created: (XMLBEANS-431) Code error in method resolve of
StscImporter.java
Code error in method resolve of StscImporter.java
-------------------------------------------------
Key: XMLBEANS-431
URL: https://issues.apache.org/jira/browse/XMLBEANS-431
Project: XMLBeans
Issue Type: Bug
Affects Versions: Version 2.3, Version 2.3.1, Version 2.4 , Version 2.4.1 , Version 2.5, Version 2.5.1
Reporter: Youssouf Mhoma
In class org.apache.xmlbeans.impl.schema.StscImporter
The method resolve(URI base, String child) is bugged:
=======================================
public static URI resolve(URI base, String child)
throws URISyntaxException
{
URI childUri = new URI(child);
URI ruri = base.resolve(childUri);
...
if (("file".equals(ruri.getScheme())) && (!(child.equals(ruri))) &&
(base.getPath().startsWith("//")) && (!(ruri.getPath().startsWith("//"))))
{
....
}
return ruri;
}
=======================================
1)
I did get a null pointer exception everytime on schema including others schemas that were referenced by "file:" URI.
I understood that it was in this method (painfull debug).
You see that in the "if" test the second comparison is made between a String and a URI
!(child.equals(ruri))
It is always true because a String is never equals to an URI.
So it should be actually :
!(childUri .equals(ruri))
This correction would prevent me to get my nullpointer exception that i explain in point 2.
2)
Second in command is the
base.getPath().startsWith("//"))
I always have a base.getPath() == null.
So when i access this test, it result to a null pointer exception.
I suggest before going there to test the null value:
=======================================
if (("file".equals(ruri.getScheme())) && (!(childUri .equals(ruri)))){
String basePath=base.getPath();
String ruriPath=ruri.getPath();
if( (basePath!=null)&&(basePath.startsWith("//")) && (ruriPath!=null) && (!(ruriPath.startsWith("//"))))
{
....
}
=======================================
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org