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)
| 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]; |
nothing calls this directly
no test coverage detected