diff options
author | desperateCoder <echotodevnull@gmail.com> | 2023-04-21 13:24:42 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2024-01-03 16:12:53 +0300 |
commit | 3a5755c61cdb605d6750bb048b80440b4a493df0 (patch) | |
tree | 8220442082002f4528066ab177aaa0889bcc3121 /app/src/main/java/it/niedermann/nextcloud/deck/remote | |
parent | fbe97f4fb0508e6a90bdb51f59136c9fc74a076c (diff) |
more output on constraint violations
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/remote')
3 files changed, 19 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/AttachmentDataProvider.java b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/AttachmentDataProvider.java index 7cc798831..db02a6fc6 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/AttachmentDataProvider.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/AttachmentDataProvider.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; import java.time.Instant; import java.util.List; +import java.util.stream.Collectors; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.database.DataBaseAdapter; @@ -38,9 +39,13 @@ public class AttachmentDataProvider extends AbstractSyncDataProvider<Attachment> public void onInsertFailed(DataBaseAdapter dataBaseAdapter, RuntimeException cause, Account account, long accountId, List<Attachment> response, Attachment entityFromServer) { Account foundAccount = dataBaseAdapter.getAccountByIdDirectly(accountId); Card foundCard = dataBaseAdapter.getCardByLocalIdDirectly(accountId, entityFromServer.getCardId()); + List<Long> accountIDs = dataBaseAdapter.getAllAccountsDirectly().stream().map(Account::getId).collect(Collectors.toList()); + List<Long> allCardIDs = dataBaseAdapter.getAllCardIDs(); throw new RuntimeException("Error creating Attachment.\n" + "AccountID: "+accountId+" (parent-DataProvider gave CardID: "+card.getLocalId()+" in account "+card.getAccountId()+") (existing: "+(foundAccount != null)+")\n" + - "cardID: "+entityFromServer.getCardId()+" (existing: "+(foundCard != null)+")", cause); + "cardID: "+entityFromServer.getCardId()+" (existing: "+(foundCard != null)+")\n" + + "all existing account-IDs: "+accountIDs + "\n" + + "all existing card-IDs: "+allCardIDs, cause); } @Override diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/CardDataProvider.java b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/CardDataProvider.java index c90040b4d..b67e94f8f 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/CardDataProvider.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/CardDataProvider.java @@ -10,6 +10,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.database.DataBaseAdapter; @@ -50,9 +51,13 @@ public class CardDataProvider extends AbstractSyncDataProvider<FullCard> { public void onInsertFailed(DataBaseAdapter dataBaseAdapter, RuntimeException cause, Account account, long accountId, List<FullCard> response, FullCard entityFromServer) { Account foundAccount = dataBaseAdapter.getAccountByIdDirectly(accountId); Stack foundStack = dataBaseAdapter.getStackByLocalIdDirectly(entityFromServer.getEntity().getStackId()); - throw new RuntimeException("Error creating Attachment.\n" + + List<Long> accountIDs = dataBaseAdapter.getAllAccountsDirectly().stream().map(Account::getId).collect(Collectors.toList()); + List<Long> allStackIDs = dataBaseAdapter.getAllStackIDs(); + throw new RuntimeException("Error creating Card.\n" + "AccountID: "+accountId+" (parent-DataProvider gave StackID: "+stack.getLocalId()+" in account "+stack.getAccountId()+") (existing: "+(foundAccount != null)+")\n" + - "stackID: "+entityFromServer.getEntity().getStackId()+" (existing: "+(foundStack != null)+")", cause); + "stackID: "+entityFromServer.getEntity().getStackId()+" (existing: "+(foundStack != null)+")\n" + + "all existing account-IDs: "+accountIDs + "\n" + + "all existing stack-IDs: "+ allStackIDs, cause); } @Override diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/DeckCommentsDataProvider.java b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/DeckCommentsDataProvider.java index 973a12652..ac88f3219 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/DeckCommentsDataProvider.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/remote/helpers/providers/DeckCommentsDataProvider.java @@ -8,6 +8,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.concurrent.CountDownLatch; +import java.util.stream.Collectors; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.database.DataBaseAdapter; @@ -55,10 +56,14 @@ public class DeckCommentsDataProvider extends AbstractSyncDataProvider<OcsCommen DeckComment comment = entityFromServer.getSingle(); Card foundCard = dataBaseAdapter.getCardByLocalIdDirectly(accountId, comment.getObjectId()); DeckComment foundComment = dataBaseAdapter.getCommentByLocalIdDirectly(accountId, comment.getParentId()); + List<Long> accountIDs = dataBaseAdapter.getAllAccountsDirectly().stream().map(Account::getId).collect(Collectors.toList()); + List<Long> allCardIDs = dataBaseAdapter.getAllCardIDs(); throw new RuntimeException("Error creating Comment.\n" + "AccountID: "+accountId+" (existing: "+(foundAccount != null)+")\n" + "cardID: "+comment.getObjectId()+" (parent-DataProvider gave CardID: "+card.getLocalId()+" in account "+card.getAccountId()+") (existing: "+(foundCard != null)+")\n" + - "parentID: "+comment.getParentId()+" (existing: "+(foundComment != null)+")", cause); + "parentID: "+comment.getParentId()+" (existing: "+(foundComment != null)+")\n" + + "all existing account-IDs: "+accountIDs + "\n" + + "all existing card-IDs: "+allCardIDs, cause); } private void verifyCommentListIntegrity(List<OcsComment> comments) { |