Search in sources :

Example 1 with MappingFailedException

use of com.intellij.util.io.MappingFailedException in project intellij-community by JetBrains.

the class IncProjectBuilder method build.

public void build(CompileScope scope, boolean forceCleanCaches) throws RebuildRequestedException {
    final LowMemoryWatcher memWatcher = LowMemoryWatcher.register(() -> {
        JavacMain.clearCompilerZipFileCache();
        myProjectDescriptor.dataManager.flush(false);
        myProjectDescriptor.timestamps.getStorage().force();
    });
    startTempDirectoryCleanupTask();
    CompileContextImpl context = null;
    try {
        context = createContext(scope);
        runBuild(context, forceCleanCaches);
        myProjectDescriptor.dataManager.saveVersion();
        reportRebuiltModules(context);
        reportUnprocessedChanges(context);
    } catch (StopBuildException e) {
        reportRebuiltModules(context);
        reportUnprocessedChanges(context);
        // some builder decided to stop the build
        // report optional progress message if any
        final String msg = e.getMessage();
        if (!StringUtil.isEmptyOrSpaces(msg)) {
            myMessageDispatcher.processMessage(new ProgressMessage(msg));
        }
    } catch (BuildDataCorruptedException e) {
        LOG.info(e);
        requestRebuild(e, e);
    } catch (ProjectBuildException e) {
        LOG.info(e);
        final Throwable cause = e.getCause();
        if (cause instanceof PersistentEnumerator.CorruptedException || cause instanceof MappingFailedException || cause instanceof IOException || cause instanceof BuildDataCorruptedException) {
            requestRebuild(e, cause);
        } else {
            // should stop the build with error
            final String errMessage = e.getMessage();
            final CompilerMessage msg;
            if (StringUtil.isEmptyOrSpaces(errMessage)) {
                msg = new CompilerMessage("", cause != null ? cause : e);
            } else {
                final String causeMessage = cause != null ? cause.getMessage() : "";
                msg = new CompilerMessage("", BuildMessage.Kind.ERROR, StringUtil.isEmptyOrSpaces(causeMessage) || errMessage.trim().endsWith(causeMessage) ? errMessage : errMessage + ": " + causeMessage);
            }
            myMessageDispatcher.processMessage(msg);
        }
    } finally {
        memWatcher.stop();
        flushContext(context);
        // wait for async tasks
        final CanceledStatus status = context == null ? CanceledStatus.NULL : context.getCancelStatus();
        synchronized (myAsyncTasks) {
            for (Future task : myAsyncTasks) {
                if (status.isCanceled()) {
                    break;
                }
                waitForTask(status, task);
            }
        }
    }
}
Also used : CanceledStatus(org.jetbrains.jps.api.CanceledStatus) MappingFailedException(com.intellij.util.io.MappingFailedException) IOException(java.io.IOException) BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException) BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException)

Example 2 with MappingFailedException

use of com.intellij.util.io.MappingFailedException in project intellij-community by JetBrains.

the class DefaultIdeaErrorLogger method handle.

@Override
public void handle(IdeaLoggingEvent event) {
    if (ourLoggerBroken)
        return;
    try {
        Throwable throwable = event.getThrowable();
        final MemoryKind kind = getOOMErrorKind(throwable);
        if (kind != null) {
            ourOomOccurred = true;
            SwingUtilities.invokeAndWait(() -> new OutOfMemoryDialog(kind).show());
        } else if (throwable instanceof MappingFailedException) {
            processMappingFailed(event);
        } else if (!ourOomOccurred) {
            MessagePool messagePool = MessagePool.getInstance();
            messagePool.addIdeFatalMessage(event);
        }
    } catch (Throwable e) {
        String message = e.getMessage();
        //noinspection InstanceofCatchParameter
        if (message != null && message.contains("Could not initialize class com.intellij.diagnostic.MessagePool") || e instanceof NullPointerException && ApplicationManager.getApplication() == null) {
            ourLoggerBroken = true;
        }
    }
}
Also used : MemoryKind(com.intellij.diagnostic.VMOptions.MemoryKind) MappingFailedException(com.intellij.util.io.MappingFailedException)

Example 3 with MappingFailedException

use of com.intellij.util.io.MappingFailedException in project intellij-community by JetBrains.

the class DefaultIdeaErrorLogger method canHandle.

@Override
public boolean canHandle(IdeaLoggingEvent event) {
    if (ourLoggerBroken)
        return false;
    try {
        UpdateChecker.checkForUpdate(event);
        boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
        ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
        boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter) submitter).showErrorInRelease(event);
        //noinspection ThrowableResultOfMethodCallIgnored
        return notificationEnabled || showPluginError || ApplicationManagerEx.getApplicationEx().isInternal() || getOOMErrorKind(event.getThrowable()) != null || event.getThrowable() instanceof MappingFailedException;
    } catch (LinkageError e) {
        if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
            ourLoggerBroken = true;
        }
        throw e;
    }
}
Also used : ErrorReportSubmitter(com.intellij.openapi.diagnostic.ErrorReportSubmitter) MappingFailedException(com.intellij.util.io.MappingFailedException)

Aggregations

MappingFailedException (com.intellij.util.io.MappingFailedException)3 MemoryKind (com.intellij.diagnostic.VMOptions.MemoryKind)1 ErrorReportSubmitter (com.intellij.openapi.diagnostic.ErrorReportSubmitter)1 IOException (java.io.IOException)1 CanceledStatus (org.jetbrains.jps.api.CanceledStatus)1 BuildDataCorruptedException (org.jetbrains.jps.builders.storage.BuildDataCorruptedException)1