NullPointerException when trying to list prepared transactions as JSON

This commit is contained in:
Tom Ross 2015-12-07 17:57:43 +00:00 committed by Clebert Suconic
parent a95784096d
commit f29ab83727
2 changed files with 14 additions and 2 deletions

View File

@ -72,7 +72,13 @@ public abstract class TransactionDetail {
detailJson.put(KEY_XID_BRANCH_QUAL, new String(this.xid.getBranchQualifier()));
JSONArray msgsJson = new JSONArray();
List<TransactionOperation> txops = this.transaction.getAllOperations();
List<TransactionOperation> txops = null;
if (this.transaction != null) {
txops = this.transaction.getAllOperations();
}
detailJson.put(KEY_TX_RELATED_MESSAGES, msgsJson);
if (txops == null) {
return detailJson;

View File

@ -392,8 +392,14 @@ public class TransactionImpl implements Transaction {
@Override
public synchronized List<TransactionOperation> getAllOperations() {
if (operations != null) {
return new ArrayList<TransactionOperation>(operations);
}
else {
return new ArrayList<TransactionOperation>();
}
}
@Override
public void putProperty(final int index, final Object property) {