Skip to content

Commit

Permalink
fix: Fix incorrect processing of Json, remove unused fields
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
  • Loading branch information
o-kopysov committed Jun 27, 2024
1 parent 0db1b06 commit 3c9f1ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ private static String buildContent(Map.Entry<String, ArrayList<Object>> entry) {
.replaceAll("\\[\"\"\\]", "[]")
.replaceAll(
"incompatible_with\" : (\".*?\"), \"name",
"incompatible_with\" : \\[$1\\], \"name");
"incompatible_with\" : \\[$1\\], \"name")
.replaceAll("\\{\"\"\\}", "\"\"");
content = content.substring(1, content.length() - 1);
if (content.endsWith("}")) {
content = content.substring(0, content.length() - 1) + "\"}";
Expand All @@ -291,43 +292,20 @@ private static String buildContent(Map.Entry<String, ArrayList<Object>> entry) {
private class ScanossJsonStructure {
private String component;
private String file;
private String file_hash;
private String file_url;
private String id;
private String latest;
private ArrayList<ScanossLicense> licenses;
private String lines;
private String matched;
private String oss_lines;
private ArrayList<String> purl;
private String release_date;
private ScanossServer server;
private String source_hash;
private String status;
private String url;
private String url_hash;
private String vendor;
private String version;

private class ScanossLicense {
private String checklist_url;
private String copyleft;
private ArrayList<String> incompatible_with;
private String name;
private String osadl_updated;
private String patent_hints;
private String source;
private String url;
}

private class ScanossServer {
private KbVersion kb_version;
private String version;

private class KbVersion {
private String daily;
private String monthly;
}
}
}
}
2 changes: 2 additions & 0 deletions src/test/resources/A_B.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"status": "pending",
"url": "https://github.com/ShiftMediaProject/FFmpeg",
"url_hash": "cf73511d784cddc8b080c199948c98dd",
"url_stats": {},
"vendor": "ShiftMediaProject",
"version": "4.5.r103180"
}
Expand Down Expand Up @@ -177,6 +178,7 @@
"status": "pending",
"url": "https://pypi.org/project/scanoss",
"url_hash": "721d702fc347c87457be94b27e66eac5",
"url_stats": {},
"vendor": "SCANOSS",
"version": "0.7.0"
}
Expand Down

0 comments on commit 3c9f1ec

Please sign in to comment.