rdiankov / collada-dom

COLLADA Document Object Model (DOM) C++ Library
78 stars 40 forks source link

Openrave crashes reading Collada zae on Windows 7 due to invalid URI in daeIOPluginCommon.cpp #8

Closed pshustad closed 10 years ago

pshustad commented 10 years ago

I have after quite much effort managed to build the Openrave github master branch - linking the collada-dom github build on a Windows 7 64 bit machine under Visual Studio 2010.

When running the tutorial_ik5d example, I get the following output and python crashes:

openrave.py --example tutorial_ik5d

[colladareader.cpp:110 OpenRAVE::ColladaReader::daeOpenRAVEURIResolver::resolveElement] daeOpenRAVEURIResolver::resolveElement() - Failed to resolve C:\Users\pshustad\AppData\Local\Temp\087e-e302-2a3f-ddd7\./neuronics-katana.dae#vscene 
[colladareader.cpp:3385 OpenRAVE::ColladaReader::handleError] COLLADA error: daeStandardURIResolver::resolveElement() - Failed to resolve C:\Users\pshustad\AppData\Local\Temp\087e-e302-2a3f-ddd7\./neuronics-katana.dae#vscene
DOC: C:\Users\pshustad\AppData\Local\Temp\087e-e302-2a3f-ddd7\./neuronics-katana.daescheme openrave
[colladareader.cpp:110 OpenRAVE::ColladaReader::daeOpenRAVEURIResolver::resolveElement] daeOpenRAVEURIResolver::resolveElement() - Failed to resolve C:\Users\pshustad\AppData\Local\Temp\087e-e302-2a3f-ddd7\./neuronics-katana.dae#kscene 
[colladareader.cpp:3385 OpenRAVE::ColladaReader::handleError] COLLADA error: daeStandardURIResolver::resolveElement() - Failed to resolve C:\Users\pshustad\AppData\Local\Temp\087e-e302-2a3f-ddd7\./neuronics-katana.dae#kscene
[environment-core.h:475 Environment::Load] load failed on file data/katanatable.env.xml
...

Note the strange looking URI, i.e. the \./neuronics-katana.dae#vscene fragment.

pshustad commented 10 years ago

Proposed fix is to convert the rootFilePathto a proper URI before passing it to the daeURI constructor:

diff --git a/dom/src/dae/daeIOPluginCommon.cpp b/dom/src/dae/daeIOPluginCommon.cpp
index 1553454..b18555f 100644
--- a/dom/src/dae/daeIOPluginCommon.cpp
+++ b/dom/src/dae/daeIOPluginCommon.cpp
@@ -92,7 +92,7 @@ daeInt daeIOPluginCommon::read(const daeURI& uri, daeString docBuffer)
         if (zaeHandler.isZipFile())
         {
             string rootFilePath = zaeHandler.obtainRootFilePath();
-            daeURI rootFileURI(*fileURI.getDAE(), rootFilePath);
+           daeURI rootFileURI(*fileURI.getDAE(),cdom::nativePathToUri(rootFilePath));
             domObject = readFromFile(rootFileURI);
             if (!domObject)
             {

After this fix, the tutorial_ik5d example (and others) work as expected

rdiankov commented 10 years ago

it must have been an adventure getting windows to work. thanks for the patch ;0)

pshustad commented 10 years ago

Hi Rosen. Thank you. Please let me know if you are interested in the patches I had to make to the OpenRave master as well. I compiled with Boost 1.46.1, using Python 2.6 and had to do quite a few changes to the Openrave libraries in order to make it compile and run.

Regards, Per

From: Rosen Diankov [mailto:notifications@github.com] Sent: 8. september 2014 15:07 To: rdiankov/collada-dom Cc: Per Sandved Hustad Subject: Re: [collada-dom] Openrave crashes reading Collada zae on Windows 7 due to invalid URI in daeIOPluginCommon.cpp (#8)

it must have been an adventure getting windows to work. thanks for the patch ;0)

— Reply to this email directly or view it on GitHubhttps://github.com/rdiankov/collada-dom/issues/8#issuecomment-54814224.

rdiankov commented 10 years ago

sure! please send them.