Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for PKL UUID mismatches between the AssetMap and the PKL #381

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/com/netflix/imflibrary/app/IMPAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ public static Map<String, List<ErrorLogger.ErrorObject>> analyzePackage(File roo
IMFErrorLogger packingListErrorLogger = new IMFErrorLoggerImpl();
try {
PackingList packingList = new PackingList(new File(rootFile, packingListAsset.getPath().toString()));
if (!packingList.getUUID().equals(packingListAsset.getUUID())) {
assetMapErrorLogger.addError(IMFErrorLogger.IMFErrors.ErrorCodes.IMF_AM_ERROR,
IMFErrorLogger.IMFErrors.ErrorLevels.NON_FATAL,
String.format("AssetMap references PKL with ID %s, but PKL contains ID %s", packingListAsset.getUUID().toString(), packingList.getUUID().toString()));
}
packingListErrorLogger.addAllErrors(packingList.getErrors());
Map<UUID, PayloadRecord> trackFileIDToHeaderPartitionPayLoadMap = new HashMap<>();
for (PackingList.Asset asset : packingList.getAssets()) {
Expand Down Expand Up @@ -419,7 +424,7 @@ public static List<ApplicationComposition> analyzeApplicationCompositions( File
Map<String, List<ErrorLogger.ErrorObject>> errorMap,
Map<UUID, PayloadRecord> trackFileIDToHeaderPartitionPayLoadMap) throws IOException {
List<ApplicationComposition> applicationCompositionList = new ArrayList<>();

for (PackingList.Asset asset : packingList.getAssets()) {
if (asset.getType().equals(PackingList.Asset.TEXT_XML_TYPE)) {
URI path = assetMap.getPath(asset.getUUID());
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/netflix/imflibrary/app/IMPAnalyzerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void IMPAnalyzerTestIDMismatches() throws IOException
if (e.getKey().matches("CPL.*Virtual Track Conformance")) {
Assert.assertEquals(e.getValue().size(), 1);
}
else if (e.getKey().matches("ASSETMAP.*")) {
Assert.assertEquals(e.getValue().size(), 1);
e.getValue().get(0).getErrorDescription().contains("ERROR-AssetMap references PKL with ID f5e93462-aed2-44ad-a4ba-2adb65823e7d, but PKL contains ID f5e93462-aed2-44ad-a4ba-2adb65823e7c");
}
else if (e.getKey().matches("CPL.*")) {
Assert.assertEquals(e.getValue().size(), 2);
e.getValue().get(0).getErrorDescription().contains("ERROR-UUID 0eb3d1b9-b77b-4d3f-bbe5-7c69b15dca84 in the CPL is not same as UUID 0eb3d1b9-b77b-4d3f-bbe5-7c69b15dca85 of the CPL in the AssetMap");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</ChunkList>
</Asset>
<Asset>
<Id>urn:uuid:f5e93462-aed2-44ad-a4ba-2adb65823e7c</Id>
<Id>urn:uuid:f5e93462-aed2-44ad-a4ba-2adb65823e7d</Id>
<PackingList>true</PackingList>
<ChunkList>
<Chunk>
Expand Down
Loading