MCPcopy Index your code
hub / github.com/zaproxy/zaproxy / AddOn

Method AddOn

zap/src/main/java/org/zaproxy/zap/control/AddOn.java:485–494  ·  view source on GitHub ↗

Constructs an AddOn from the given file. The #MANIFEST_FILE_NAME ZIP file entry is read after validating that the add-on is a valid add-on. The installation status of the add-on is 'not installed'. @param file the file of the add-on @throws InvalidAddOnException (si

(Path file)

Source from the content-addressed store, hash-verified

483 * @see #isAddOn(Path)
484 */
485 public AddOn(Path file) throws IOException {
486 ValidationResult result = isValidAddOn(file);
487 if (result.getValidity() != ValidationResult.Validity.VALID) {
488 throw new InvalidAddOnException(result);
489 }
490 this.id = extractAddOnId(file.getFileName().toString());
491 this.file = file.toFile();
492 this.size = Files.size(file);
493 readZapAddOnXmlFile(result.getManifest());
494 }
495
496 private static String extractAddOnId(String fileName) {
497 return fileName.substring(0, fileName.lastIndexOf('.')).split("-")[0];

Callers

nothing calls this directly

Calls 15

isValidAddOnMethod · 0.95
getValidityMethod · 0.95
extractAddOnIdMethod · 0.95
readZapAddOnXmlFileMethod · 0.95
getManifestMethod · 0.95
getFileMethod · 0.95
getSizeMethod · 0.95
createUrlMethod · 0.95
getInfoMethod · 0.95
getDateMethod · 0.95
getHashMethod · 0.95
loadManifestFileMethod · 0.95

Tested by

no test coverage detected