Add items with null album-ids into the item-map with an empty string key#1267
Merged
seehamrun merged 16 commits intodtinit:masterfrom Oct 3, 2023
Merged
Add items with null album-ids into the item-map with an empty string key#1267seehamrun merged 16 commits intodtinit:masterfrom
seehamrun merged 16 commits intodtinit:masterfrom
Conversation
…m photos and videos
…roject into album-id-fix
osamahan999
commented
Sep 15, 2023
| .collect(Collectors.groupingBy(DownloadableFile::getFolderId)); | ||
| // Null album-id items get sent here into the empty string key | ||
| itemsByAlbumId.put( | ||
| "", |
Collaborator
Author
There was a problem hiding this comment.
Only thing left to consider is whether or not an empty string is a possible album id. In the case that it is, this code will overwrite those items.
Maybe to be safe I can change the upload loop to upload the items in albums and then I can separately loop through the album-less items and upload them, without having to add them to the map.
Collaborator
There was a problem hiding this comment.
maybe instead of empty string, we could use some other identifier that wont be an album id? something like "$JOB_ID$_ALBUMLESS_ITEMS" ?
Collaborator
Author
There was a problem hiding this comment.
Done, made the album-less identifier be the job id appended to "_ALBUMLESS_ITEMS", and tested locally. Thanks Siham!
aksingh737
approved these changes
Sep 28, 2023
seehamrun
approved these changes
Oct 3, 2023
.../src/main/java/org/datatransferproject/datatransfer/google/common/gphotos/GPhotosUpload.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous to this fix, if an item has no album id, the entire import fails.
java.lang.NullPointerException: element cannot be mapped to a null key at java.base/java.util.Objects.requireNonNull(Objects.java:246) at java.base/java.util.stream.Collectors.lambda$groupingBy$53(Collectors.java:1134) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at org.datatransferproject.datatransfer.google.common.gphotos.GPhotosUpload.uploadItemsViaBatching(GPhotosUpload.java:137) at org.datatransferproject.datatransfer.google.photos.GooglePhotosImporter.importPhotos(GooglePhotosImporter.java:212) at org.datatransferproject.datatransfer.google.photos.GooglePhotosImporter.importItem(GooglePhotosImporter.java:191) at org.datatransferproject.datatransfer.google.photos.GooglePhotosImporter.importItem(GooglePhotosImporter.java:69) at org.datatransferproject.transfer.CallableImporter.call(CallableImporter.java:68) at org.datatransferproject.transfer.CallableImporter.call(CallableImporter.java:37) at org.datatransferproject.types.transfer.retry.RetryingCallable.call(RetryingCallable.java:85) ... ...