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

Method createAddOn

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

Convenience method that attempts to create an AddOn from the given file. A warning is logged if the add-on is invalid and an error if an error occurred while creating it. @param file the file of the add-on. @return a container with the AddOn, or empty if not valid or an error oc

(Path file)

Source from the content-addressed store, hash-verified

452 * @since 2.8.0
453 */
454 public static Optional<AddOn> createAddOn(Path file) {
455 try {
456 return Optional.of(new AddOn(file));
457 } catch (AddOn.InvalidAddOnException e) {
458 String logMessage = "Invalid add-on: " + file.toString() + ".";
459 if (LOGGER.isDebugEnabled() || Constant.isDevMode()) {
460 LOGGER.warn(logMessage, e);
461 } else {
462 LOGGER.warn("{} {}", logMessage, e.getMessage());
463 }
464 } catch (Exception e) {
465 LOGGER.error("Failed to create an add-on from: {}", file, e);
466 }
467 return Optional.empty();
468 }
469
470 /**
471 * Constructs an {@code AddOn} from the given {@code file}.

Callers 2

addDirectoryMethod · 0.95
installNewExtensionsMethod · 0.95

Calls 4

isDevModeMethod · 0.95
getMessageMethod · 0.65
toStringMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected