use of org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException in project java-tron by tronprotocol.
the class AssetIssueActuatorTest method repeatAssetIssue.
@Test
public void repeatAssetIssue() {
AssetIssueActuator actuator = new AssetIssueActuator(getContract(), dbManager);
TransactionResultCapsule ret = new TransactionResultCapsule();
try {
dbManager.getAssetIssueStore().put(ByteArray.fromString(NAME), new AssetIssueCapsule(getContract().unpack(Contract.AssetIssueContract.class)));
actuator.validate();
actuator.execute(ret);
Assert.assertTrue(false);
} catch (ContractValidateException e) {
Assert.assertTrue(e instanceof ContractValidateException);
AccountCapsule owner = dbManager.getAccountStore().get(ByteArray.fromHexString(OWNER_ADDRESS));
AssetIssueCapsule assetIssueCapsule = dbManager.getAssetIssueStore().get(ByteArray.fromString(NAME));
Assert.assertNotNull(assetIssueCapsule);
Assert.assertNull(owner.getInstance().getAssetMap().get(NAME));
} catch (ContractExeException e) {
Assert.assertFalse(e instanceof ContractExeException);
} catch (InvalidProtocolBufferException e) {
Assert.assertFalse(e instanceof InvalidProtocolBufferException);
} finally {
dbManager.getAssetIssueStore().delete(ByteArray.fromString(NAME));
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException in project android_packages_apps_Dialer by LineageOS.
the class Coalescer method rowsShouldBeCombined.
/**
* @param row1 a row from {@link AnnotatedCallLog}
* @param row2 a row from {@link AnnotatedCallLog}
*/
private static boolean rowsShouldBeCombined(DialerPhoneNumberUtil dialerPhoneNumberUtil, ContentValues row1, ContentValues row2) {
// TODO: Real implementation.
DialerPhoneNumber number1;
DialerPhoneNumber number2;
try {
number1 = DialerPhoneNumber.parseFrom(row1.getAsByteArray(AnnotatedCallLog.NUMBER));
number2 = DialerPhoneNumber.parseFrom(row2.getAsByteArray(AnnotatedCallLog.NUMBER));
} catch (InvalidProtocolBufferException e) {
throw Assert.createAssertionFailException("error parsing DialerPhoneNumber proto", e);
}
if (!number1.hasDialerInternalPhoneNumber() && !number2.hasDialerInternalPhoneNumber()) {
// Empty numbers should not be combined.
return false;
}
if (!number1.hasDialerInternalPhoneNumber() || !number2.hasDialerInternalPhoneNumber()) {
// An empty number should not be combined with a non-empty number.
return false;
}
return dialerPhoneNumberUtil.isExactMatch(number1, number2);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException in project android_packages_apps_Dialer by LineageOS.
the class SystemCallLogDataSource method getMostRecentPhoneNumber.
private static DialerPhoneNumber getMostRecentPhoneNumber(List<ContentValues> individualRowsSortedByTimestampDesc) {
DialerPhoneNumber dialerPhoneNumber;
byte[] protoBytes = individualRowsSortedByTimestampDesc.get(0).getAsByteArray(AnnotatedCallLog.NUMBER);
try {
dialerPhoneNumber = DialerPhoneNumber.parseFrom(protoBytes);
} catch (InvalidProtocolBufferException e) {
throw Assert.createAssertionFailException("couldn't parse DialerPhoneNumber", e);
}
return dialerPhoneNumber;
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException in project bisq-core by bisq-network.
the class IssuanceService method getRevealedVotes.
private Set<RevealedVote> getRevealedVotes(Map<String, SecretKey> secretKeysByTxIdMap, Set<BlindVoteWithRevealTxId> blindVoteWithRevealTxIdSet) {
return blindVoteWithRevealTxIdSet.stream().map(blindVoteWithRevealTxId -> {
try {
// TODO check if cloning here is needed (we might want to keep the blindVote separated from the
// blindVoteList to the RevealedVote...)
final BlindVote blindVote = BlindVote.clone(blindVoteWithRevealTxId.getBlindVote());
final byte[] encryptedProposalList = blindVote.getEncryptedProposalList();
final SecretKey secretKey = secretKeysByTxIdMap.get(blindVoteWithRevealTxId.getTxId());
final byte[] decrypted = Encryption.decrypt(encryptedProposalList, secretKey);
// TODO move to ProposalList
final PB.PersistableEnvelope envelope = PB.PersistableEnvelope.parseFrom(decrypted);
ProposalList proposalList = ProposalList.fromProto(envelope.getProposalList());
return new RevealedVote(proposalList, blindVote);
} catch (CryptoException e) {
e.printStackTrace();
return null;
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
return null;
}
}).filter(Objects::nonNull).collect(Collectors.toSet());
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException in project Signal-Android by signalapp.
the class WebRtcCallService method onMessage.
@Override
public void onMessage(DataChannel.Buffer buffer) {
Log.w(TAG, "onMessage...");
try {
byte[] data = new byte[buffer.data.remaining()];
buffer.data.get(data);
Data dataMessage = Data.parseFrom(data);
if (dataMessage.hasConnected()) {
Log.w(TAG, "hasConnected...");
Intent intent = new Intent(this, WebRtcCallService.class);
intent.setAction(ACTION_CALL_CONNECTED);
intent.putExtra(EXTRA_CALL_ID, dataMessage.getConnected().getId());
startService(intent);
} else if (dataMessage.hasHangup()) {
Log.w(TAG, "hasHangup...");
Intent intent = new Intent(this, WebRtcCallService.class);
intent.setAction(ACTION_REMOTE_HANGUP);
intent.putExtra(EXTRA_CALL_ID, dataMessage.getHangup().getId());
startService(intent);
} else if (dataMessage.hasVideoStreamingStatus()) {
Log.w(TAG, "hasVideoStreamingStatus...");
Intent intent = new Intent(this, WebRtcCallService.class);
intent.setAction(ACTION_REMOTE_VIDEO_MUTE);
intent.putExtra(EXTRA_CALL_ID, dataMessage.getVideoStreamingStatus().getId());
intent.putExtra(EXTRA_MUTE, !dataMessage.getVideoStreamingStatus().getEnabled());
startService(intent);
}
} catch (InvalidProtocolBufferException e) {
Log.w(TAG, e);
}
}
Aggregations