public File getFile()

in src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java [76:121]


    public File getFile() {

        if (!fileFuture.isDone()) {
            if (fileFuture instanceof RunnableFuture) {
                try {
                    LOGGER.trace(
                            "Artifact file {} is not yet retrieved, downloading directly", getDependencyConflictId());
                    ((RunnableFuture<?>) fileFuture).run();
                } catch (RuntimeException e) {
                    throw new InvalidArtifactRTException(
                            getGroupId(),
                            getArtifactId(),
                            getVersion(),
                            getType(),
                            MSG_ERROR_RETRIEVING_ARTIFACT_FILE,
                            e);
                }
            } else {
                LOGGER.trace(
                        "Artifact file {} is not yet retrieved, waiting for download to complete",
                        getDependencyConflictId());
            }
        }

        try {
            File file = fileFuture.get();
            return restoreToDiskConsumer.apply(file);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new InvalidArtifactRTException(
                    getGroupId(),
                    getArtifactId(),
                    getVersion(),
                    getType(),
                    MSG_INTERRUPTED_WHILE_RETRIEVING_ARTIFACT_FILE,
                    e);
        } catch (ExecutionException e) {
            throw new InvalidArtifactRTException(
                    getGroupId(),
                    getArtifactId(),
                    getVersion(),
                    getType(),
                    MSG_ERROR_RETRIEVING_ARTIFACT_FILE,
                    e.getCause());
        }
    }