[Date Prev][Date Next] [Chronological] [Thread] [Top]

jndi.syntax.trimblanks does nothing



I have the following code (notice spaces in example string)

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;

public class MyParser {

    private static Properties _properties=new Properties();
    static{
        _properties.setProperty("jndi.syntax.direction", "right_to_left");
        _properties.setProperty("jndi.syntax.separator", ",");
        _properties.setProperty("jndi.syntax.trimblanks", "true");
    }

    public static Name parse(String path) throws InvalidNameException{
        return new CompoundName(path, _properties);
    }

    public static void main(String[] args) {
        try {                        //notice spaces!!!
            Name n=MyParser.parse(" ou=a, ou=b , ou=c, ou=d, ou=e, ou=f ");
            for(int i=0;i<n.size();++i)
                System.out.print("<"+n.get(i)+">");
        } catch (Exception e) {
                System.out.println(e.getMessage());
        }
    }
}

this code outputs the following

< ou=f >< ou=e>< ou=d>< ou=c>< ou=b >< ou=a>

As you can see, although I specify the option "jndi.syntax.trimblanks" to "true", it does not trim anything. The output should be

<ou=f><ou=e><ou=d><ou=c><ou=b><ou=a>


¿any ideas? I use JDK 1.3 on windows ¿implementation specific problem?¿try other version?

here's a class of other person that is suposed to work. As you can see it is very similar to mine.
    http://www.huihoo.org/jfox/1.1/java2html/org/huihoo/jfox/jndi/NameParserImpl.java.html


thanks in advance
Rafa