public File getFile()

in src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java [64:108]


    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(),
                            "Error retrieving artifact file",
                            e);
                }
            } else {
                LOGGER.trace(
                        "Artifact file {} is not yet retrieved, waiting for download to complete",
                        getDependencyConflictId());
            }
        }

        try {
            return fileFuture.get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new InvalidArtifactRTException(
                    getGroupId(),
                    getArtifactId(),
                    getVersion(),
                    getType(),
                    "Interrupted while retrieving artifact file",
                    e);
        } catch (ExecutionException e) {
            throw new InvalidArtifactRTException(
                    getGroupId(),
                    getArtifactId(),
                    getVersion(),
                    getType(),
                    "Error retrieving artifact file",
                    e.getCause());
        }
    }