directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <kayyag...@apache.org>
Subject Re: Problem with sorting of ldif files on Linux
Date Tue, 28 Sep 2010 10:51:36 GMT
On Tue, Sep 28, 2010 at 3:18 PM, Carsten Kaiser
<carsten.kaiser@valtech.de>wrote:

>  Hi there,
>
> we are using ApacheDS respectively the Maven ApacheDS Plugin to run our
> integration tests against a clean LDAP server instance and therefore
> populate
> it with the according schema information and setup data on test startup. We
> have different ldif files for schema and setup data especially named
> in alphabetical order
> to ensure, that the schema information is loaded before the setup data.
> Although this works fine for e.g. on MacOSX it does not work on Linux due to
> the following
> Code Snippet from class *
> org.apache.directory.server.configuration.ApacheDS*
>
> else
>
> 436 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#436>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>         {
>
> 437 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#437>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>             // get all the ldif files within the directory (should be sorted alphabetically)
>
> 438 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#438>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>             File <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File%5B%5D>[]
ldifFiles = ldifDirectory.listFiles <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File.listFiles%28java.io.FileFilter%29>(
new FileFilter <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/FileFilter.java#FileFilter>()
>
> 439 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#439>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>             {
>
> 440 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#440>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>                 public boolean  <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>accept(
File <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File>
pathname )
>
> 441 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#441>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>                 {
>
> 442 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#442>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>                     boolean isLdif = pathname.getName <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File.getName%28%29>().toLowerCase
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/String.java#String.toLowerCase%28%29>().endsWith
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/String.java#String.endsWith%28java.lang.String%29>(
".ldif" );
>
> 443 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#443>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>                     return pathname.isFile <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File.isFile%28%29>()
&& pathname.canRead <http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/File.java#File.canRead%28%29>()
&& isLdif;
>
> 444 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#444>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>                 }
>
> 445 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#445>
>
>
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.directory.server/apacheds-server-jndi/1.5.2/org/apache/directory/server/configuration/ApacheDS.java#>
>
>             } );
>
>
> According to Javadoc of class java.io.File
>
> Returns an array of abstract pathnames denoting the files in the directory
> denoted by this abstract pathname.
>
> If this abstract pathname does not denote a directory, then this method
> returns null. Otherwise an array of File objects is returned, one for each
> file or directory in the directory. Pathnames denoting the directory itself
> and the directory's parent directory are not included in the result. Each
> resulting abstract pathname is constructed from this abstract pathname using
> the File(File, String)<http://download.oracle.com/javase/1.4.2/docs/api/java/io/File.html#File%28java.io.File,%20java.lang.String%29>
constructor.
> Therefore if this pathname is absolute then each resulting pathname is
> absolute; if this pathname is relative then each resulting pathname will be
> relative to the same directory.
>
> *-> There is no guarantee that the name strings in the resulting array
> will appear in any specific order; they are not, in particular, guaranteed
> to appear in alphabetical order.*
> the assumption stated in the code snippet above is not valid and depends on
> the platform resp. Java implementation.
>
> In order to be platform independent the retrieved array of ldif files
> should be sorted in alphabetical order explicitly after retrieval.
>
so you want them in a sorted order right, can you create a JIRA for this,
will fix it

>
> Since I'm not a committer could someone please provide a patch for this
> problem?
>
> When will the next version of the maven ApacheDS plugin be available
> depending on the most current ApacheDS version (hopefully including a fix
> for this problem)? Currently it refers to 1.5.5...
>
this is not a official plugin from Apache Directory Project, so can't say
when it gets updated

>
> Kind regards,
> CAK
> *
> *
>
>
> Carsten Kaiser
> Principal Consultant
> carsten.kaiser@valtech.de
> Mobile: +49 170 5270206
>
> Valtech GmbH
> Werner-Heisenberg-Straße 2
> 63263 Neu-Isenburg
> Germany
>
> Phone: +49 6102 88468-0
> Fax: +49 6102 88468-28
>
> www.valtech.de
>
> Geschäftsführer: Ingo Kriescher
> Amtsgericht Düsseldorf HRB48672
>
>



Kiran Ayyagari

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message