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

abobrov
26.44.2009 8a13236c15cb27e62c4654fc0120aa8896633dd8
opendj-sdk/opends/src/server/org/opends/server/backends/ndb/OperationContainer.java
@@ -161,6 +161,8 @@
    Map<ObjectClass, String> ocMap = entry.getObjectClasses();
    Map<AttributeType, List<Attribute>> userAttrMap =
      entry.getUserAttributes();
    Map<NdbBlob, byte[]> blobMap =
      new HashMap<NdbBlob, byte[]>(BackendImpl.blobAttributes.size());
    ArrayList<AttributeType> userAttributes =
      new ArrayList<AttributeType>();
@@ -252,7 +254,9 @@
              }
              if (BackendImpl.blobAttributes.contains(attrName)) {
                NdbBlob blob = attrOp.getBlobHandle(attrName);
                blob.setValue(attrVal.getValue().toByteArray());
                blob.setValue(new byte[0]);
                byte[] blobBytes = attrVal.getValue().toByteArray();
                blobMap.put(blob, blobBytes);
              } else {
                attrOp.setString(attrName, attrStringVal);
              }
@@ -328,7 +332,9 @@
              }
              if (BackendImpl.blobAttributes.contains(attrName)) {
                NdbBlob blob = attrOp.getBlobHandle(attrName);
                blob.setValue(attrVal.getValue().toByteArray());
                blob.setValue(new byte[0]);
                byte[] blobBytes = attrVal.getValue().toByteArray();
                blobMap.put(blob, blobBytes);
              } else {
                attrOp.setString(attrName, attrStringVal);
              }
@@ -421,7 +427,9 @@
              }
              if (BackendImpl.blobAttributes.contains(attrName)) {
                NdbBlob blob = attrOp.getBlobHandle(attrName);
                blob.setValue(attrVal.getValue().toByteArray());
                blob.setValue(new byte[0]);
                byte[] blobBytes = attrVal.getValue().toByteArray();
                blobMap.put(blob, blobBytes);
              } else {
                attrOp.setString(attrName, attrStringVal);
              }
@@ -477,6 +485,17 @@
      }
    }
    // Move this txn into the active state and write blob data if any.
    if (!blobMap.isEmpty()) {
      ndbDATxn.execute(ExecType.NoCommit, AbortOption.AbortOnError, true);
      Set<Map.Entry<NdbBlob, byte[]>> blobEntrySet = blobMap.entrySet();
      for (Map.Entry blobEntry : blobEntrySet) {
        NdbBlob blob = (NdbBlob) blobEntry.getKey();
        byte[] blobBytes = (byte[]) blobEntry.getValue();
        blob.writeData(blobBytes);
      }
    }
    // Update dn2id table.
    NdbTransaction ndbTxn = txn.getNdbTransaction();
    if (overwrite) {