mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

dugan
16.03.2009 0e65bd2b3c0d134a28916c5045dd7901d028c43d
Fix for issue 4291 - null pointer exception using --skipDNValidation and -a
1 files modified
34 ■■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 34 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -1781,14 +1781,25 @@
      }
      private boolean checkParent(ImportIDSet record) throws DirectoryException
      private boolean checkParent(ImportIDSet record) throws DirectoryException,
              DatabaseException
      {
        DNKey.setData(record.getKey());
        byte[] v = record.toDatabase();
        long v1 = JebFormat.entryIDFromDatabase(v);
        DNValue.setData(v);
        DN dn = DN.decode(ByteString.wrap(DNKey.getData()));
        //Bypass the cache for append data, lookup the parent in DN2ID and
        //return.
        if(importConfiguration != null &&
           importConfiguration.appendToExistingData())
        {
          DN newParentDN = entryContainer.getParentWithinBase(dn);
          parentID =
             entryContainer.getDN2ID().get(null, newParentDN, LockMode.DEFAULT);
        }
        else
        {
        entryID = new EntryID(v1);
        if(parentIDMap.isEmpty())
        {
@@ -1838,6 +1849,7 @@
            return false;
          }
        }
        }
        return true;
      }
@@ -1862,6 +1874,22 @@
        }
      }
      private EntryID getParentID(DN dn) throws DatabaseException
      {
        EntryID nodeID;
        //Bypass the cache for append data, lookup the parent DN in the DN2ID
        //db.
        if (importConfiguration != null &&
            importConfiguration.appendToExistingData())
        {
          nodeID = entryContainer.getDN2ID().get(null, dn, LockMode.DEFAULT);
        }
        else
        {
          nodeID = parentIDMap.get(dn);
        }
        return nodeID;
      }
      private void id2SubTree(EntryID childID)
              throws DatabaseException, DirectoryException
@@ -1880,7 +1908,7 @@
        for (DN dn = entryContainer.getParentWithinBase(parentDN); dn != null;
             dn = entryContainer.getParentWithinBase(dn))
        {
          EntryID nodeID = parentIDMap.get(dn);
          EntryID nodeID = getParentID(dn);
          if(!id2subtreeTree.containsKey(nodeID.getDatabaseEntry().getData()))
          {
            idSet = new ImportIDSet(1, subTreeLimit, subTreeDoCount);