private void loadExtensions(Wallet wallet, WalletExtension[] extensionsList, Protos.Wallet walletProto) throws UnreadableWalletException { final Map<String, WalletExtension> extensions = new HashMap<String, WalletExtension>(); for (WalletExtension e : extensionsList) extensions.put(e.getWalletExtensionID(), e); // The Wallet object, if subclassed, might have added some extensions to itself already. In that case, don't // expect them to be passed in, just fetch them here and don't re-add. extensions.putAll(wallet.getExtensions()); for (Protos.Extension extProto : walletProto.getExtensionList()) { String id = extProto.getId(); WalletExtension extension = extensions.get(id); if (extension == null) { if (extProto.getMandatory()) { if (requireMandatoryExtensions) throw new UnreadableWalletException("Unknown mandatory extension in wallet: " + id); else log.error("Unknown extension in wallet {}, ignoring", id); } } else { log.info("Loading wallet extension {}", id); try { wallet.deserializeExtension(extension, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) { log.error("Error whilst reading mandatory extension {}, failing to read wallet", id); throw new UnreadableWalletException("Could not parse mandatory extension in wallet: " + id); } } } } }
private void loadExtensions(Wallet wallet, WalletExtension[] extensionsList, Protos.Wallet walletProto) throws UnreadableWalletException { final Map<String, WalletExtension> extensions = new HashMap<String, WalletExtension>(); for (WalletExtension e : extensionsList) extensions.put(e.getWalletExtensionID(), e); // The Wallet object, if subclassed, might have added some extensions to itself already. In that case, don't // expect them to be passed in, just fetch them here and don't re-add. extensions.putAll(wallet.getExtensions()); for (Protos.Extension extProto : walletProto.getExtensionList()) { String id = extProto.getId(); WalletExtension extension = extensions.get(id); if (extension == null) { if (extProto.getMandatory()) { if (requireMandatoryExtensions) throw new UnreadableWalletException("Unknown mandatory extension in wallet: " + id); else log.error("Unknown extension in wallet {}, ignoring", id); } } else { log.info("Loading wallet extension {}", id); try { wallet.deserializeExtension(extension, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) { log.error("Error whilst reading mandatory extension {}, failing to read wallet", id); throw new UnreadableWalletException("Could not parse mandatory extension in wallet: " + id); } } } } }
log.info("Loading wallet extension {}", id); try { wallet.deserializeExtension(extension, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) {
log.info("Loading wallet extension {}", id); try { wallet.deserializeExtension(extension, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) {
private void loadExtensions(Wallet wallet, Protos.Wallet walletProto) throws UnreadableWalletException { final Map<String, WalletExtension> extensions = wallet.getExtensions(); for (Protos.Extension extProto : walletProto.getExtensionList()) { String id = extProto.getId(); WalletExtension extension = extensions.get(id); if (extension == null) { if (extProto.getMandatory()) { if (requireMandatoryExtensions) throw new UnreadableWalletException("Unknown mandatory extension in wallet: " + id); else log.error("Unknown extension in wallet {}, ignoring", id); } } else { log.info("Loading wallet extension {}", id); try { extension.deserializeWalletExtension(wallet, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) throw new UnreadableWalletException("Could not parse mandatory extension in wallet: " + id); else log.error("Error whilst reading extension {}, ignoring: {}", id, e); } } } }
public Builder mergeFrom(org.bitcoinj.wallet.Protos.Extension other) { if (other == org.bitcoinj.wallet.Protos.Extension.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMandatory()) { setMandatory(other.getMandatory()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.bitcoinj.wallet.Protos.Extension other) { if (other == org.bitcoinj.wallet.Protos.Extension.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMandatory()) { setMandatory(other.getMandatory()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.bitcoinj.wallet.Protos.Extension other) { if (other == org.bitcoinj.wallet.Protos.Extension.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMandatory()) { setMandatory(other.getMandatory()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.bitcoinj.wallet.Protos.Extension other) { if (other == org.bitcoinj.wallet.Protos.Extension.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMandatory()) { setMandatory(other.getMandatory()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.bitcoinj.wallet.Protos.Extension other) { if (other == org.bitcoinj.wallet.Protos.Extension.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMandatory()) { setMandatory(other.getMandatory()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * <code>required bytes data = 2;</code> */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000002); data_ = getDefaultInstance().getData(); onChanged(); return this; }
/** * <code>required bytes data = 2;</code> */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000002); data_ = getDefaultInstance().getData(); onChanged(); return this; }
/** * <code>required bytes data = 2;</code> */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000002); data_ = getDefaultInstance().getData(); onChanged(); return this; }
/** * <code>required bytes data = 2;</code> */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000002); data_ = getDefaultInstance().getData(); onChanged(); return this; }
/** * <code>required bytes data = 2;</code> */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000002); data_ = getDefaultInstance().getData(); onChanged(); return this; }