public static LedgerMetadataBuilder from(LedgerMetadata other) { LedgerMetadataBuilder builder = new LedgerMetadataBuilder(); builder.metadataFormatVersion = other.getMetadataFormatVersion(); builder.ensembleSize = other.getEnsembleSize(); builder.writeQuorumSize = other.getWriteQuorumSize(); builder.ackQuorumSize = other.getAckQuorumSize(); builder.state = other.getState(); if (builder.state == State.CLOSED) { builder.lastEntryId = Optional.of(other.getLastEntryId()); builder.length = Optional.of(other.getLength()); } builder.ensembles.putAll(other.getAllEnsembles()); if (other.hasPassword()) { builder.password = Optional.of(other.getPassword()); builder.digestType = Optional.of(other.getDigestType()); } builder.ctime = other.getCtime(); /** Hack to get around fact that ctime was never versioned correctly */ builder.storeCtime = LedgerMetadataUtils.shouldStoreCtime(other); builder.customMetadata = ImmutableMap.copyOf(other.getCustomMetadata()); return builder; }
serializePassword(metadata.getPassword(), builder);
builder.setDigestType(apiToProtoDigestType(metadata.getDigestType())); serializePassword(metadata.getPassword(), builder);
passwd = metadata.getPassword(); digestType = fromApiDigestType(metadata.getDigestType()); } else { if (!Arrays.equals(passwd, metadata.getPassword())) { LOG.error("Provided passwd does not match that in metadata"); openComplete(BKException.Code.UnauthorizedAccessException, null);