|
10 | 10 | import java.io.IOException; |
11 | 11 | import java.io.UncheckedIOException; |
12 | 12 | import java.nio.file.Files; |
13 | | -import java.nio.file.Path; |
14 | 13 | import java.util.ArrayDeque; |
15 | 14 | import java.util.ArrayList; |
16 | 15 | import java.util.Collection; |
@@ -668,8 +667,7 @@ void setFlags(byte walkingFlags) { |
668 | 667 | setChildFlags(walkingFlags); |
669 | 668 | } |
670 | 669 |
|
671 | | - private ExtensionDependency getExtensionDependencyOrNull() |
672 | | - throws BootstrapDependencyProcessingException { |
| 670 | + private ExtensionDependency getExtensionDependencyOrNull() { |
673 | 671 | if (ext != null) { |
674 | 672 | return ext; |
675 | 673 | } |
@@ -719,11 +717,8 @@ Artifact getResolvedArtifact() { |
719 | 717 |
|
720 | 718 | /** |
721 | 719 | * Collects information about the conditional dependencies and adds them to the processing queue. |
722 | | - * |
723 | | - * @throws BootstrapDependencyProcessingException in case of an error |
724 | 720 | */ |
725 | | - private void collectConditionalDependencies() |
726 | | - throws BootstrapDependencyProcessingException { |
| 721 | + private void collectConditionalDependencies() { |
727 | 722 | if (ext == null || ext.info.conditionalDeps.length == 0 || ext.conditionalDepsQueued) { |
728 | 723 | return; |
729 | 724 | } |
@@ -782,27 +777,26 @@ private static boolean isFlagOn(byte flags, byte flag) { |
782 | 777 | return (flags & flag) > 0; |
783 | 778 | } |
784 | 779 |
|
785 | | - private ExtensionInfo getExtensionInfoOrNull(Artifact artifact, List<RemoteRepository> repos) |
786 | | - throws BootstrapDependencyProcessingException { |
| 780 | + private ExtensionInfo getExtensionInfoOrNull(Artifact artifact, List<RemoteRepository> repos) { |
787 | 781 | if (!artifact.getExtension().equals(ArtifactCoords.TYPE_JAR)) { |
788 | 782 | return null; |
789 | 783 | } |
790 | | - final ArtifactKey extKey = getKey(artifact); |
791 | | - ExtensionInfo ext = allExtensions.get(extKey); |
792 | | - if (ext != null) { |
793 | | - return ext == EXT_INFO_NONE ? null : ext; |
794 | | - } |
| 784 | + ExtensionInfo ext = allExtensions.computeIfAbsent(getKey(artifact), k -> resolveExtensionInfo(artifact, repos)); |
| 785 | + return ext == EXT_INFO_NONE ? null : ext; |
| 786 | + } |
| 787 | + |
| 788 | + private ExtensionInfo resolveExtensionInfo(Artifact artifact, List<RemoteRepository> repos) { |
795 | 789 | artifact = resolve(artifact, repos); |
796 | | - final Path path = artifact.getFile().toPath(); |
797 | | - final Properties descriptor = PathTree.ofDirectoryOrArchive(path).apply(BootstrapConstants.DESCRIPTOR_PATH, |
798 | | - ApplicationDependencyResolver::readExtensionProperties); |
| 790 | + final Properties descriptor = PathTree.ofDirectoryOrArchive(artifact.getFile().toPath()) |
| 791 | + .apply(BootstrapConstants.DESCRIPTOR_PATH, ApplicationDependencyResolver::readExtensionProperties); |
799 | 792 | if (descriptor == null) { |
800 | | - allExtensions.put(extKey, EXT_INFO_NONE); |
801 | | - return null; |
| 793 | + return EXT_INFO_NONE; |
| 794 | + } |
| 795 | + try { |
| 796 | + return new ExtensionInfo(artifact, descriptor, devMode); |
| 797 | + } catch (BootstrapDependencyProcessingException e) { |
| 798 | + throw new RuntimeException("Failed to collect extension information for " + artifact, e); |
802 | 799 | } |
803 | | - ext = new ExtensionInfo(artifact, descriptor, devMode); |
804 | | - allExtensions.put(extKey, ext); |
805 | | - return ext; |
806 | 800 | } |
807 | 801 |
|
808 | 802 | private static Properties readExtensionProperties(PathVisit visit) { |
|
0 commit comments