Example usage for java.util.concurrent ExecutionException getMessage

List of usage examples for java.util.concurrent ExecutionException getMessage

Introduction

In this page you can find the example usage for java.util.concurrent ExecutionException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.epam.reportportal.apache.http.impl.execchain.MainClientExec.java

public CloseableHttpResponse execute(final HttpRoute route, final HttpRequestWrapper request,
        final HttpClientContext context, final HttpExecutionAware execAware) throws IOException, HttpException {
    Args.notNull(route, "HTTP route");
    Args.notNull(request, "HTTP request");
    Args.notNull(context, "HTTP context");

    AuthState targetAuthState = context.getTargetAuthState();
    if (targetAuthState == null) {
        targetAuthState = new AuthState();
        context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, targetAuthState);
    }//from   w  ww .ja  v a  2 s . com
    AuthState proxyAuthState = context.getProxyAuthState();
    if (proxyAuthState == null) {
        proxyAuthState = new AuthState();
        context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);
    }

    if (request instanceof HttpEntityEnclosingRequest) {
        Proxies.enhanceEntity((HttpEntityEnclosingRequest) request);
    }

    Object userToken = context.getUserToken();

    final ConnectionRequest connRequest = connManager.requestConnection(route, userToken);
    if (execAware != null) {
        if (execAware.isAborted()) {
            connRequest.cancel();
            throw new RequestAbortedException("Request aborted");
        } else {
            execAware.setCancellable(connRequest);
        }
    }

    final RequestConfig config = context.getRequestConfig();

    final HttpClientConnection managedConn;
    try {
        final int timeout = config.getConnectionRequestTimeout();
        managedConn = connRequest.get(timeout > 0 ? timeout : 0, TimeUnit.MILLISECONDS);
    } catch (final InterruptedException interrupted) {
        Thread.currentThread().interrupt();
        throw new RequestAbortedException("Request aborted", interrupted);
    } catch (final ExecutionException ex) {
        Throwable cause = ex.getCause();
        if (cause == null) {
            cause = ex;
        }
        throw new RequestAbortedException("Request execution failed", cause);
    }

    context.setAttribute(HttpCoreContext.HTTP_CONNECTION, managedConn);

    if (config.isStaleConnectionCheckEnabled()) {
        // validate connection
        if (managedConn.isOpen()) {
            this.log.debug("Stale connection check");
            if (managedConn.isStale()) {
                this.log.debug("Stale connection detected");
                managedConn.close();
            }
        }
    }

    final ConnectionHolder connHolder = new ConnectionHolder(this.log, this.connManager, managedConn);
    try {
        if (execAware != null) {
            execAware.setCancellable(connHolder);
        }

        HttpResponse response;
        for (int execCount = 1;; execCount++) {

            if (execCount > 1 && !Proxies.isRepeatable(request)) {
                throw new NonRepeatableRequestException(
                        "Cannot retry request " + "with a non-repeatable request entity.");
            }

            if (execAware != null && execAware.isAborted()) {
                throw new RequestAbortedException("Request aborted");
            }

            if (!managedConn.isOpen()) {
                this.log.debug("Opening connection " + route);
                try {
                    establishRoute(proxyAuthState, managedConn, route, request, context);
                } catch (final TunnelRefusedException ex) {
                    if (this.log.isDebugEnabled()) {
                        this.log.debug(ex.getMessage());
                    }
                    response = ex.getResponse();
                    break;
                }
            }
            final int timeout = config.getSocketTimeout();
            if (timeout >= 0) {
                managedConn.setSocketTimeout(timeout);
            }

            if (execAware != null && execAware.isAborted()) {
                throw new RequestAbortedException("Request aborted");
            }

            if (this.log.isDebugEnabled()) {
                this.log.debug("Executing request " + request.getRequestLine());
            }

            if (!request.containsHeader(AUTH.WWW_AUTH_RESP)) {
                if (this.log.isDebugEnabled()) {
                    this.log.debug("Target auth state: " + targetAuthState.getState());
                }
                this.authenticator.generateAuthResponse(request, targetAuthState, context);
            }
            if (!request.containsHeader(AUTH.PROXY_AUTH_RESP) && !route.isTunnelled()) {
                if (this.log.isDebugEnabled()) {
                    this.log.debug("Proxy auth state: " + proxyAuthState.getState());
                }
                this.authenticator.generateAuthResponse(request, proxyAuthState, context);
            }

            response = requestExecutor.execute(request, managedConn, context);

            // The connection is in or can be brought to a re-usable state.
            if (reuseStrategy.keepAlive(response, context)) {
                // Set the idle duration of this connection
                final long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
                if (this.log.isDebugEnabled()) {
                    final String s;
                    if (duration > 0) {
                        s = "for " + duration + " " + TimeUnit.MILLISECONDS;
                    } else {
                        s = "indefinitely";
                    }
                    this.log.debug("Connection can be kept alive " + s);
                }
                connHolder.setValidFor(duration, TimeUnit.MILLISECONDS);
                connHolder.markReusable();
            } else {
                connHolder.markNonReusable();
            }

            if (needAuthentication(targetAuthState, proxyAuthState, route, response, context)) {
                // Make sure the response body is fully consumed, if present
                final HttpEntity entity = response.getEntity();
                if (connHolder.isReusable()) {
                    EntityUtils.consume(entity);
                } else {
                    managedConn.close();
                    if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
                            && proxyAuthState.getAuthScheme() != null
                            && proxyAuthState.getAuthScheme().isConnectionBased()) {
                        this.log.debug("Resetting proxy auth state");
                        proxyAuthState.reset();
                    }
                    if (targetAuthState.getState() == AuthProtocolState.SUCCESS
                            && targetAuthState.getAuthScheme() != null
                            && targetAuthState.getAuthScheme().isConnectionBased()) {
                        this.log.debug("Resetting target auth state");
                        targetAuthState.reset();
                    }
                }
                // discard previous auth headers
                final HttpRequest original = request.getOriginal();
                if (!original.containsHeader(AUTH.WWW_AUTH_RESP)) {
                    request.removeHeaders(AUTH.WWW_AUTH_RESP);
                }
                if (!original.containsHeader(AUTH.PROXY_AUTH_RESP)) {
                    request.removeHeaders(AUTH.PROXY_AUTH_RESP);
                }
            } else {
                break;
            }
        }

        if (userToken == null) {
            userToken = userTokenHandler.getUserToken(context);
            context.setAttribute(HttpClientContext.USER_TOKEN, userToken);
        }
        if (userToken != null) {
            connHolder.setState(userToken);
        }

        // check for entity, release connection if possible
        final HttpEntity entity = response.getEntity();
        if (entity == null || !entity.isStreaming()) {
            // connection not needed and (assumed to be) in re-usable state
            connHolder.releaseConnection();
            return Proxies.enhanceResponse(response, null);
        } else {
            return Proxies.enhanceResponse(response, connHolder);
        }
    } catch (final ConnectionShutdownException ex) {
        final InterruptedIOException ioex = new InterruptedIOException("Connection has been shut down");
        ioex.initCause(ex);
        throw ioex;
    } catch (final HttpException ex) {
        connHolder.abortConnection();
        throw ex;
    } catch (final IOException ex) {
        connHolder.abortConnection();
        throw ex;
    } catch (final RuntimeException ex) {
        connHolder.abortConnection();
        throw ex;
    }
}

From source file:org.apache.http.HC4.impl.execchain.MainClientExec.java

@Override
public CloseableHttpResponse execute(final HttpRoute route, final HttpRequestWrapper request,
        final HttpClientContext context, final HttpExecutionAware execAware) throws IOException, HttpException {
    Args.notNull(route, "HTTP route");
    Args.notNull(request, "HTTP request");
    Args.notNull(context, "HTTP context");

    AuthState targetAuthState = context.getTargetAuthState();
    if (targetAuthState == null) {
        targetAuthState = new AuthState();
        context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, targetAuthState);
    }//ww  w. j  a  v  a 2  s  .  co m
    AuthState proxyAuthState = context.getProxyAuthState();
    if (proxyAuthState == null) {
        proxyAuthState = new AuthState();
        context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);
    }

    if (request instanceof HttpEntityEnclosingRequest) {
        RequestEntityProxy.enhance((HttpEntityEnclosingRequest) request);
    }

    Object userToken = context.getUserToken();

    final ConnectionRequest connRequest = connManager.requestConnection(route, userToken);
    if (execAware != null) {
        if (execAware.isAborted()) {
            connRequest.cancel();
            throw new RequestAbortedException("Request aborted");
        } else {
            execAware.setCancellable(connRequest);
        }
    }

    final RequestConfig config = context.getRequestConfig();

    final HttpClientConnection managedConn;
    try {
        final int timeout = config.getConnectionRequestTimeout();
        managedConn = connRequest.get(timeout > 0 ? timeout : 0, TimeUnit.MILLISECONDS);
    } catch (final InterruptedException interrupted) {
        Thread.currentThread().interrupt();
        throw new RequestAbortedException("Request aborted", interrupted);
    } catch (final ExecutionException ex) {
        Throwable cause = ex.getCause();
        if (cause == null) {
            cause = ex;
        }
        throw new RequestAbortedException("Request execution failed", cause);
    }

    context.setAttribute(HttpCoreContext.HTTP_CONNECTION, managedConn);

    if (config.isStaleConnectionCheckEnabled()) {
        // validate connection
        if (managedConn.isOpen()) {
            this.log.debug("Stale connection check");
            if (managedConn.isStale()) {
                this.log.debug("Stale connection detected");
                managedConn.close();
            }
        }
    }

    final ConnectionHolder connHolder = new ConnectionHolder(this.log, this.connManager, managedConn);
    try {
        if (execAware != null) {
            execAware.setCancellable(connHolder);
        }

        HttpResponse response;
        for (int execCount = 1;; execCount++) {

            if (execCount > 1 && !RequestEntityProxy.isRepeatable(request)) {
                throw new NonRepeatableRequestException(
                        "Cannot retry request " + "with a non-repeatable request entity.");
            }

            if (execAware != null && execAware.isAborted()) {
                throw new RequestAbortedException("Request aborted");
            }

            if (!managedConn.isOpen()) {
                this.log.debug("Opening connection " + route);
                try {
                    establishRoute(proxyAuthState, managedConn, route, request, context);
                } catch (final TunnelRefusedException ex) {
                    if (this.log.isDebugEnabled()) {
                        this.log.debug(ex.getMessage());
                    }
                    response = ex.getResponse();
                    break;
                }
            }
            final int timeout = config.getSocketTimeout();
            if (timeout >= 0) {
                managedConn.setSocketTimeout(timeout);
            }

            if (execAware != null && execAware.isAborted()) {
                throw new RequestAbortedException("Request aborted");
            }

            if (this.log.isDebugEnabled()) {
                this.log.debug("Executing request " + request.getRequestLine());
            }

            if (!request.containsHeader(AUTH.WWW_AUTH_RESP)) {
                if (this.log.isDebugEnabled()) {
                    this.log.debug("Target auth state: " + targetAuthState.getState());
                }
                this.authenticator.generateAuthResponse(request, targetAuthState, context);
            }
            if (!request.containsHeader(AUTH.PROXY_AUTH_RESP) && !route.isTunnelled()) {
                if (this.log.isDebugEnabled()) {
                    this.log.debug("Proxy auth state: " + proxyAuthState.getState());
                }
                this.authenticator.generateAuthResponse(request, proxyAuthState, context);
            }

            response = requestExecutor.execute(request, managedConn, context);

            // The connection is in or can be brought to a re-usable state.
            if (reuseStrategy.keepAlive(response, context)) {
                // Set the idle duration of this connection
                final long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
                if (this.log.isDebugEnabled()) {
                    final String s;
                    if (duration > 0) {
                        s = "for " + duration + " " + TimeUnit.MILLISECONDS;
                    } else {
                        s = "indefinitely";
                    }
                    this.log.debug("Connection can be kept alive " + s);
                }
                connHolder.setValidFor(duration, TimeUnit.MILLISECONDS);
                connHolder.markReusable();
            } else {
                connHolder.markNonReusable();
            }

            if (needAuthentication(targetAuthState, proxyAuthState, route, response, context)) {
                // Make sure the response body is fully consumed, if present
                final HttpEntity entity = response.getEntity();
                if (connHolder.isReusable()) {
                    EntityUtils.consume(entity);
                } else {
                    managedConn.close();
                    if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
                            && proxyAuthState.getAuthScheme() != null
                            && proxyAuthState.getAuthScheme().isConnectionBased()) {
                        this.log.debug("Resetting proxy auth state");
                        proxyAuthState.reset();
                    }
                    if (targetAuthState.getState() == AuthProtocolState.SUCCESS
                            && targetAuthState.getAuthScheme() != null
                            && targetAuthState.getAuthScheme().isConnectionBased()) {
                        this.log.debug("Resetting target auth state");
                        targetAuthState.reset();
                    }
                }
                // discard previous auth headers
                final HttpRequest original = request.getOriginal();
                if (!original.containsHeader(AUTH.WWW_AUTH_RESP)) {
                    request.removeHeaders(AUTH.WWW_AUTH_RESP);
                }
                if (!original.containsHeader(AUTH.PROXY_AUTH_RESP)) {
                    request.removeHeaders(AUTH.PROXY_AUTH_RESP);
                }
            } else {
                break;
            }
        }

        if (userToken == null) {
            userToken = userTokenHandler.getUserToken(context);
            context.setAttribute(HttpClientContext.USER_TOKEN, userToken);
        }
        if (userToken != null) {
            connHolder.setState(userToken);
        }

        // check for entity, release connection if possible
        final HttpEntity entity = response.getEntity();
        if (entity == null || !entity.isStreaming()) {
            // connection not needed and (assumed to be) in re-usable state
            connHolder.releaseConnection();
            return new HttpResponseProxy(response, null);
        } else {
            return new HttpResponseProxy(response, connHolder);
        }
    } catch (final ConnectionShutdownException ex) {
        final InterruptedIOException ioex = new InterruptedIOException("Connection has been shut down");
        ioex.initCause(ex);
        throw ioex;
    } catch (final HttpException ex) {
        connHolder.abortConnection();
        throw ex;
    } catch (final IOException ex) {
        connHolder.abortConnection();
        throw ex;
    } catch (final RuntimeException ex) {
        connHolder.abortConnection();
        throw ex;
    }
}

From source file:org.corpus_tools.pepper.core.PepperJobImpl.java

/**
 * Starts the conversion of this job.//from  www. ja  v  a2 s.c o m
 * <ul>
 * <li>If the single steps of the job has not already been wired, they will
 * be wired.
 * <li>
 * <li>If {@link PepperImporter#importCorpusStructure(SCorpusGraph)} has not
 * already been called, it will be done.
 * <li>
 * </ul>
 */
public void convert() {
    if (!inProgress.tryLock()) {
        throw new PepperInActionException(
                "Cannot run convert() of job '" + getId() + "', since this job was already started.");
    }

    inProgress.lock();
    try {
        startTime = System.currentTimeMillis();
        status = JOB_STATUS.INITIALIZING;
        if (!isWired) {
            wire();
        }
        if (!isReadyToStart) {
            Collection<Pair<Step, Collection<String>>> notReadyModules = checkReadyToStart();
            if (notReadyModules.size() != 0) {
                StringBuilder str = new StringBuilder();
                for (Pair<Step, Collection<String>> problems : notReadyModules) {
                    str.append("[");
                    str.append(problems.getLeft());
                    str.append(": ");
                    str.append(problems.getRight());
                    str.append("], ");
                }
                throw new PepperException("Cannot run Pepper job '" + getId()
                        + "', because at least one of the involved jobs is not ready to run: '" + str.toString()
                        + "'. ");
            }
        }
        status = JOB_STATUS.IMPORTING_CORPUS_STRUCTURE;
        if (!isImportedCorpusStructure) {
            importCorpusStructures();
        }
        status = JOB_STATUS.IMPORTING_DOCUMENT_STRUCTURE;
        List<Pair<ModuleControllerImpl, Future<?>>> futures = new Vector<Pair<ModuleControllerImpl, Future<?>>>();
        // create a future for each step
        for (Step step : getAllSteps()) {
            if (step.getModuleController().getPepperModule().getSaltProject() == null)
                step.getModuleController().getPepperModule().setSaltProject(getSaltProject());
            {
                futures.add(new ImmutablePair<ModuleControllerImpl, Future<?>>(step.getModuleController(),
                        step.getModuleController().processDocumentStructures()));
            }
        }

        // log workflow information
        int stepNum = 0; // current number of step
        StringBuilder str = new StringBuilder();
        for (Step step : getAllSteps()) {
            stepNum++;
            str.append("+----------------------------------- step ");
            str.append(stepNum);
            str.append(" -----------------------------------+\n");

            String format = "|%-15s%-63s|\n";
            str.append(
                    String.format(format, step.getModuleType().toString().toLowerCase() + ":", step.getName()));
            str.append(String.format(format, "path:", step.getCorpusDesc().getCorpusPath()));
            if (MODULE_TYPE.IMPORTER.equals(step.getModuleType())) {
                int idxCorpusGraph = getSaltProject().getCorpusGraphs().indexOf(
                        ((PepperImporter) step.getModuleController().getPepperModule()).getCorpusGraph());
                str.append(String.format(format, "corpus index:", idxCorpusGraph));
            }

            boolean hasProperties = false;
            StringBuilder propStr = new StringBuilder();
            if (step.getModuleController().getPepperModule().getProperties()
                    .getPropertyDesctriptions() != null) {
                // log all properties of all modules and their values

                format = "|               %-25s%-38s|\n";
                for (PepperModuleProperty<?> prop : step.getModuleController().getPepperModule().getProperties()
                        .getPropertyDesctriptions()) {
                    if (prop.getValue() != null) {
                        hasProperties = true;
                        propStr.append(String.format(format, prop.getName() + ":", prop.getValue()));
                    }
                }
            }
            format = "|%-15s%-63s|\n";
            if (hasProperties) {
                str.append(String.format(format, "properties:", ""));
                str.append(propStr.toString());
            } else {
                str.append(String.format(format, "properties:", "- none -"));
            }
            str.append("|                                                                              |\n");
        }
        str.append("+------------------------------------------------------------------------------+\n");
        logger.info(str.toString());

        for (Pair<ModuleControllerImpl, Future<?>> future : futures) {
            // wait until all document-structures have been imported
            try {
                future.getRight().get();
            } catch (ExecutionException e) {
                if ((e.getCause() != null) && (e.getCause() instanceof PepperException)) {
                    throw (PepperException) e.getCause();
                }
                throw new PepperModuleException("Failed to process document by module '" + future.getLeft()
                        + "'. Nested exception was: ", e.getCause());
            } catch (InterruptedException e) {
                if ((e.getCause() != null) && (e.getCause() instanceof PepperException)) {
                    throw (PepperException) e.getCause();
                }
                throw new PepperFWException("Failed to process document by module '" + future.getLeft()
                        + "'. Nested exception was: ", e.getCause());
            } catch (CancellationException e) {
                if ((e.getCause() != null) && (e.getCause() instanceof PepperException)) {
                    throw (PepperException) e.getCause();
                }
                throw new PepperFWException("Failed to process document by module '" + future.getLeft()
                        + "'. Nested exception was: ", e.getCause());
            }
        }
        status = JOB_STATUS.ENDED;
    } catch (RuntimeException e) {
        status = JOB_STATUS.ENDED_WITH_ERRORS;
        if (e instanceof PepperException) {
            throw (PepperException) e;
        } else {
            throw new PepperFWException(
                    "An exception occured in job '" + getId()
                            + "' while importing the corpus-structure. See nested exception: " + e.getMessage(),
                    e);
        }
    } finally {
        inProgress.unlock();
    }
}

From source file:org.corpus_tools.pepper.core.PepperJobImpl.java

/**
 * Imports corpus structures of all registered
 * {@link ImportCorpusStructureTest} steps. After calling
 * {@link PepperImporter#importCorpusStructure(SCorpusGraph)} , all
 * following modules will be asked, if they want to influence the order of
 * importing documents. If this is the case, an order is created and put to
 * all {@link PepperImporter} objects. <br/>
 * This method produces as much as {@link SCorpusGraph} objects as
 * {@link Step} given in import step list {@link #getImportSteps()}. The
 * position of {@link SCorpusGraph} corresponding to {@link PepperImporter}
 * (importing that graph) in {@link SaltProject#getCorpusGraphs()} is
 * equivalent to position of {@link Step} in list {@link #getImportSteps()}.
 *//*from w w  w.  j  a v  a 2 s .  c o m*/
protected synchronized void importCorpusStructures() {
    try {
        if (!isWired) {
            wire();
        }
        List<Future<?>> futures = new Vector<Future<?>>();
        int numOfImportStep = 0;
        for (Step importStep : getImportSteps()) {
            if (getSaltProject() == null) {
                throw new PepperFWException("Cannot import corpus structure, because no salt project is set.");
            }
            SCorpusGraph sCorpusGraph = null;

            if ((getSaltProject().getCorpusGraphs().size() > numOfImportStep)
                    && (getSaltProject().getCorpusGraphs().get(numOfImportStep) != null)) {
                sCorpusGraph = getSaltProject().getCorpusGraphs().get(numOfImportStep);
            } else {
                sCorpusGraph = SaltFactory.createSCorpusGraph();
                getSaltProject().addCorpusGraph(sCorpusGraph);
            }

            futures.add(importStep.getModuleController().importCorpusStructure(sCorpusGraph));
            numOfImportStep++;
        }
        for (Future<?> future : futures) {
            // wait until all corpus structures have been imported
            try {
                future.get();
            } catch (ExecutionException e) {
                throw new PepperModuleException("Failed to import corpus by module. Nested exception was: ",
                        e.getCause());
            } catch (InterruptedException e) {
                throw new PepperFWException("Failed to import corpus by module. Nested exception was: ",
                        e.getCause());
            } catch (CancellationException e) {
                throw new PepperFWException("Failed to import corpus by module. Nested exception was: ",
                        e.getCause());
            }
        }
        int i = 0;
        for (Step step : getImportSteps()) {
            if (getSaltProject().getCorpusGraphs().get(i) == null) {
                throw new PepperModuleException("The importer '" + step.getModuleController().getPepperModule()
                        + "' did not import a corpus structure.");
            }

            // handle proposed import order
            List<Identifier> importOrder = unifyProposedImportOrders(getSaltProject().getCorpusGraphs().get(i));
            for (Identifier sDocumentId : importOrder) {
                DocumentControllerImpl documentController = new DocumentControllerImpl();
                SDocument sDoc = (SDocument) sDocumentId.getIdentifiableElement();
                if (sDoc.getDocumentGraph() == null) {
                    sDoc.setDocumentGraph(SaltFactory.createSDocumentGraph());
                }
                documentController.setDocument(sDoc);
                // sets flag to determine whether garbage collector should
                // be called after document was send to sleep
                if (getConfiguration() != null) {
                    documentController.setCallGC(getConfiguration().getGcAfterDocumentSleep());
                }
                getDocumentControllers().add(documentController);
                File docFile = null;
                String prefix = sDoc.getName();
                File tmpPath = new File(getConfiguration().getWorkspace().getAbsolutePath() + "/" + getId());
                if (!tmpPath.exists()) {
                    if (!tmpPath.mkdirs()) {
                        logger.warn("Cannot create folder {}. ", tmpPath);
                    }
                }
                try {
                    if (prefix.length() < 3) {
                        prefix = prefix + "artificial";
                    }
                    docFile = File.createTempFile(prefix, "." + SaltUtil.FILE_ENDING_SALT_XML, tmpPath);
                } catch (IOException e) {
                    throw new PepperFWException(
                            "Cannot store document '" + sDoc.getName() + "' to file '" + docFile
                                    + "' in folder for temporary files '" + tmpPath + "'. " + e.getMessage(),
                            e);
                }
                documentController.setLocation(URI.createFileURI(docFile.getAbsolutePath()));
                if (!getConfiguration().getKeepDocuments()) {
                    docFile.deleteOnExit();
                }

                initialDocumentBuses.get(i).put(documentController);
                // notify document controller about all modules in workflow
                documentController.addModuleControllers(step.getModuleController());
                for (Step manipulationStep : getManipulationSteps()) {
                    documentController.addModuleControllers(manipulationStep.getModuleController());
                }
                for (Step exportStep : getExportSteps()) {
                    documentController.addModuleControllers(exportStep.getModuleController());
                }
            }
            initialDocumentBuses.get(i).finish(InitialDocumentBus.ID_INTITIAL);
            i++;
        }
        isImportedCorpusStructure = true;
    } catch (RuntimeException e) {
        if (e instanceof PepperException) {
            throw (PepperException) e;
        } else {
            throw new PepperFWException("An exception occured in job '" + getId()
                    + "' while importing the corpus-structure. See nested exception: ", e);
        }
    }
}