Hi :)
 
  I am facing an AssertionFailedError during the execution of
testLocalFileWithEmptyBaseURI() from
org.apache.xml.security.test.utils.resolver.ResourceResolverTest class. All
the source files have been downloaded from SVN trunk
  I'm using Windows XP, Eclipse 3.4, Maven 2.0.9 and the file build.xml used
in the test is located in the "C:\Eclipse-Ganymede\Workspaces-JIRA\XML
Security\xmlsec" directory.
  During the execution of testLocalFileWithEmptyBaseURI method(), the call
to resolve(Attr uri, String BaseURI) from ResourceResolver class leads to
engineResolve(Attr uri, String BaseURI) method of the
ResolverLocalFilesystem class. Inside this method, the translation of the
uri fragment ("file:C:\Eclipse-Ganymede\Workspaces-JIRA\XML
Security\xmlsec/build.xml") to a filename through static
translateUriToFilename(String uri) does not work :
===
   private static String translateUriToFilename(String uri) {
 
      String subStr = uri.substring(FILE_URI_LENGTH);
 
(...)
      if (subStr.charAt(1) == ':') {
        // we're running M$ Windows, so this works fine
         return subStr;
      }
      // we're running some UNIX, so we have to prepend a slash
      return "/" + subStr;
   }
=== 
  In the code above, subStr = :\Eclipse-Ganymede\Workspaces-JIRA\XML
Security\xmlsec/build.xml and the result of (subStr.charAt(1) == ':') is
false. Then we assume we are using UNIX OS and prepend a slash. The returned
filename is /:\Eclipse-Ganymede\Workspaces-JIRA\XML
Security\xmlsec/build.xml which is not understood by Windows :| And the test
fails.
  This piece of code works perfectly when called during
org.apache.xml.security.test.c14n.implementations.testA(). In fact, the
reason is that there is a mistake in the construction of the uri parameter
in testLocalFileWithEmptyBaseURI() :
===
 String file = "file:" + basedir + "/build.xml";  <===================
Should be "file:/"
 uriAttr.setValue(file);
 ResourceResolver res = ResourceResolver.getInstance(uriAttr, file);
 try {
     res.resolve(uriAttr, "");
 } catch (Exception e) {
     fail(e.getMessage());
 }
    }
===
"file:" should be replaced by "file:/".
  I guess, it would be safer to use the following :
 
File myFile = new java.io.File(basedir + "/build.xml");
String file = myFile.toURI().toString();
 
(...)
 
  Hope this could help.
  Eric
 

Eric TOURNIER
Expertise technique Java / J2EE / XML / AOP - Spring / Hibernate / Maven
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
KEYNECTIS
11-13 Rue René Jacques - 92131 ISSY-LES-MOULINEAUX Cedex
Tél : 01.55.64.22.94 - Fax : 01.55.64.22.01
 <outbind://60/eric.tourn...@keynectis.com> eric.tourn...@keynectis.com 

Les chiens de cirque sautent quand le dresseur fait claquer son fouet, mais
le chien vraiment bien dressé
est celui qui exécute son saut périlleux sans avoir besoin du fouet.
_________________________________________________________
Georges ORWELL « Cela ne se fait pas » ou la censure voilée, Chronique À ma
guise n°19, 7 juillet 1944 


European leading provider of trust technologies and services, KEYNECTIS
empowers corporates, governments, 
financial institutions and business partners to secure IDs and electronic
transactions to the benefit of the end users.
KEYNECTIS offer, software and services, benefits from experience of more
than 25 millions digital certificates issued 
and 10 millions documents signed using its technologies.

        Merci de prendre en considération votre responsabilité
environnementale avant d'imprimer cet e-mail    
 

<<attb918c.gif>>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to