InputStream in = AddObjectPanel.class.getClassLoader().getResourceAsStream("dn.properties");
InputStream in = AddObjectPanel.class.getClassLoader().getResourceAsStream("ldap/editors/dn.properties");
    protected void ok() {        String dnKey = null;        String dnAttribute = null;        String objectClass = (String)objectClassList.getSelectedValue();        try {            dn = new Properties();            InputStream in = AddObjectPanel.class.getClassLoader().getResourceAsStream("dn.properties");            dn.load(in);                        dnKey = dn.getProperty(objectClass.toLowerCase() +                                          ".dncomponents").trim();            dnAttribute = dn.getProperty(objectClass.toLowerCase() +                                                ".dnattribute").trim();                    }        catch(NullPointerException e) {            e.printStackTrace();        }        catch (IOException e) {            logger.log(Level.SEVERE, null, e);	}                try {            boolean automatic = false;                        Vector keyComponents = new Vector();                        String dn = dnTextField.getText();                        if (parent.trim().equals(dn.trim())) {                if (dnKey!=null) {                    automatic = true;                    StringTokenizer st = new StringTokenizer(dnKey,",");                    while (st.hasMoreTokens()) {                        keyComponents.add(st.nextToken());                    }                }            }                        Attributes attributes = editor.getData();            Attributes specifiedAttributes = new BasicAttributes();            NamingEnumeration enum = attributes.getAll();            HashMap dnMap = new HashMap();            	    while (enum.hasMore()) {		Attribute attribute = (Attribute)enum.next();                if (attribute.size() != 0) {                    if (automatic) {                        if (keyComponents.contains(attribute.getID().toLowerCase()))                            dnMap.put((attribute.getID().toLowerCase()),attribute.get(0));                    }                    specifiedAttributes.put(attribute);                }            }                        specifiedAttributes.put(new                BasicAttribute("objectClass",objectClass));            StringBuffer dnBuffer = new StringBuffer();            if (dnMap.size()>0) {                for (int i = 0;i<dnMap.size();i++)                     dnBuffer.append((String)dnMap.get(keyComponents.get(i)) + "_");                dn = dnBuffer.toString();                int l = dn.length();                if (dn.endsWith("_"))                    dn = dn.substring(0,l-1);                dn = dnAttribute + "=" + dn + "," + parent;             }                        String ownDN = dn;            int index =  dn.indexOf(",");            if (index>0)                ownDN = dn.substring(0,index);            	    getContext().createSubcontext(dn, specifiedAttributes);                        STree tree = (STree)SessionManager.getSession().getProperty("tree");                        LdapTreeNode parentNode =                (LdapTreeNode)tree.getLastSelectedPathComponent();            if (parentNode == null)                parentNode = (LdapTreeNode)(((DefaultTreeModel)(tree.getModel())).getRoot());            LdapTreeNode node = new LdapTreeNode(getContext(),parentNode,ownDN);            DefaultTreeModel model = (DefaultTreeModel)tree.getModel();            model.insertNodeInto(node,parentNode,0);            //model.nodesWereInserted(parentNode, new int[]            //  {parentNode.getChildCount()-1});                        editor.setData(emptyAttributes);            objectClassLabel.setVisible(false);            editor.setVisible(false);            okButton.setVisible(false);            cancelButton.setVisible(false);            addButton.setVisible(true);            objectClassList.setVisible(true);        }