mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external build: throw BuildDataCorruptedException instead of generic RuntimeException if caches are corrupted
This commit is contained in:
@@ -40,9 +40,7 @@ import org.jetbrains.jps.util.JpsPathUtil;
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -242,6 +240,13 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
final Ref<CompilationLog> result = Ref.create(null);
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
final List<String> generatedFilePaths = new ArrayList<String>();
|
||||
getCompilerManager().addCompilationStatusListener(new CompilationStatusAdapter() {
|
||||
@Override
|
||||
public void fileGenerated(String outputRoot, String relativePath) {
|
||||
generatedFilePaths.add(relativePath);
|
||||
}
|
||||
}, myTestRootDisposable);
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -257,6 +262,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
ExitStatus status = CompileDriver.getExternalBuildExitStatus(compileContext);
|
||||
result.set(new CompilationLog(status == ExitStatus.UP_TO_DATE,
|
||||
CompilerManagerImpl.getPathsToRecompile(), CompilerManagerImpl.getPathsToDelete(),
|
||||
generatedFilePaths,
|
||||
compileContext.getMessages(CompilerMessageCategory.ERROR),
|
||||
compileContext.getMessages(CompilerMessageCategory.WARNING)));
|
||||
}
|
||||
@@ -421,16 +427,19 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
protected class CompilationLog {
|
||||
private final Set<String> myRecompiledPaths;
|
||||
private final Set<String> myDeletedPaths;
|
||||
private final Set<String> myGeneratedPaths;
|
||||
private final boolean myExternalBuildUpToDate;
|
||||
private final CompilerMessage[] myErrors;
|
||||
private final CompilerMessage[] myWarnings;
|
||||
|
||||
public CompilationLog(boolean externalBuildUpToDate, String[] recompiledPaths, String[] deletedPaths, CompilerMessage[] errors, CompilerMessage[] warnings) {
|
||||
public CompilationLog(boolean externalBuildUpToDate, String[] recompiledPaths, String[] deletedPaths, List<String> generatedFilePaths,
|
||||
CompilerMessage[] errors, CompilerMessage[] warnings) {
|
||||
myExternalBuildUpToDate = externalBuildUpToDate;
|
||||
myErrors = errors;
|
||||
myWarnings = warnings;
|
||||
myRecompiledPaths = getRelativePaths(recompiledPaths);
|
||||
myDeletedPaths = getRelativePaths(deletedPaths);
|
||||
myGeneratedPaths = new THashSet<String>(generatedFilePaths, FileUtil.PATH_HASHING_STRATEGY);
|
||||
}
|
||||
|
||||
public void assertUpToDate() {
|
||||
@@ -448,6 +457,10 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
checkDeleted();
|
||||
}
|
||||
|
||||
public void assertGenerated(String... expected) {
|
||||
assertSet("generated", myGeneratedPaths, expected);
|
||||
}
|
||||
|
||||
public void assertDeleted(String... expected) {
|
||||
checkRecompiled();
|
||||
checkDeleted(expected);
|
||||
@@ -459,10 +472,12 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
}
|
||||
|
||||
private void checkRecompiled(String... expected) {
|
||||
if (useExternalCompiler()) return;
|
||||
assertSet("recompiled", myRecompiledPaths, expected);
|
||||
}
|
||||
|
||||
private void checkDeleted(String... expected) {
|
||||
if (useExternalCompiler()) return;
|
||||
assertSet("deleted", myDeletedPaths, expected);
|
||||
}
|
||||
|
||||
@@ -475,7 +490,6 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
}
|
||||
|
||||
private void assertSet(String name, Set<String> actual, String[] expected) {
|
||||
if (useExternalCompiler()) return;
|
||||
for (String path : expected) {
|
||||
if (!actual.remove(path)) {
|
||||
Assert.fail("'" + path + "' is not " + name + ". " + name + ": " + new HashSet<String>(actual));
|
||||
|
||||
+4
-7
@@ -18,6 +18,7 @@ package org.jetbrains.jps.builders.impl.storage;
|
||||
import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.builders.BuildTarget;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataPaths;
|
||||
import org.jetbrains.jps.builders.storage.StorageProvider;
|
||||
@@ -55,7 +56,7 @@ public class BuildTargetStorages extends CompositeStorageOwner {
|
||||
return provider.createStorage(myPaths.getTargetDataRoot(myTarget));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -68,12 +69,8 @@ public class BuildTargetStorages extends CompositeStorageOwner {
|
||||
try {
|
||||
return (S)lazyValue.getValue();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof IOException) {
|
||||
throw (IOException)cause;
|
||||
}
|
||||
throw e;
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.jps.builders.BuildRootIndex;
|
||||
import org.jetbrains.jps.builders.DirtyFilesHolder;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.incremental.*;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage;
|
||||
@@ -177,12 +178,8 @@ public class JavaBuilderUtil {
|
||||
|
||||
return additionalPassRequired;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof IOException) {
|
||||
throw ((IOException)cause);
|
||||
}
|
||||
throw e;
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
finally {
|
||||
context.processMessage(new ProgressMessage("")); // clean progress messages
|
||||
|
||||
@@ -21,6 +21,7 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.Opcodes;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -270,7 +271,7 @@ public class ClassRepr extends Proto {
|
||||
myUsages =(Set<UsageRepr.Usage>)RW.read(UsageRepr.externalizer(context), new THashSet<UsageRepr.Usage>(), in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +295,7 @@ public class ClassRepr extends Proto {
|
||||
RW.save(myUsages, UsageRepr.externalizer(myContext), out);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,8 +508,8 @@ public class ClassRepr extends Proto {
|
||||
try {
|
||||
bas.close();
|
||||
}
|
||||
catch (final Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
catch (final IOException e) {
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
|
||||
usages.add(bas.toString());
|
||||
|
||||
+4
-3
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.io.PersistentStringEnumerator;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -83,7 +84,7 @@ class DependencyContext {
|
||||
return myEnumerator.valueOf(s);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ class DependencyContext {
|
||||
return StringUtil.isEmpty(s) ? myEmptyName : myEnumerator.enumerate(s);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ class DependencyContext {
|
||||
myEnumerator.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -26,6 +26,7 @@ import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntObjectProcedure;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -50,7 +51,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
return collection == null? NULL_COLLECTION : collection;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -62,7 +63,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
return myMap.containsMapping(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +85,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +117,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +132,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +175,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +186,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
myMap.remove(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +219,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
myMap.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,13 +244,13 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
|
||||
return procedure.execute(key, myMap.get(key));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -22,6 +22,7 @@ import com.intellij.util.io.IntInlineKeyDescriptor;
|
||||
import com.intellij.util.io.PersistentHashMap;
|
||||
import gnu.trove.TIntObjectProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -49,13 +50,13 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
return v1 == null? NULL_OBJ : v1;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
return myMap.containsMapping(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
myMap.put(key, value);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
myMap.remove(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
myMap.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,13 +142,13 @@ public class IntObjectPersistentMaplet<V> extends IntObjectMaplet<V>{
|
||||
return value == null? proc.execute(key, null) : proc.execute(key, value);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-10
@@ -22,6 +22,7 @@ import com.intellij.util.io.KeyDescriptor;
|
||||
import com.intellij.util.io.PersistentHashMap;
|
||||
import gnu.trove.TIntObjectProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
@@ -53,7 +54,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
return collection == null? NULL_COLLECTION : collection;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -66,7 +67,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
return myMap.containsMapping(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
myMap.remove(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
myMap.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,13 +224,13 @@ class IntObjectPersistentMultiMaplet<V extends Streamable> extends IntObjectMult
|
||||
return procedure.execute(key, myMap.get(key));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
import org.jetbrains.asm4.Opcodes;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.incremental.storage.FileKeyDescriptor;
|
||||
|
||||
import java.io.File;
|
||||
@@ -165,7 +166,7 @@ public class Mappings {
|
||||
return new Mappings(this);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,16 @@ import com.intellij.util.io.DataExternalizer;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author: db
|
||||
@@ -141,7 +145,7 @@ class MethodRepr extends ProtoMember {
|
||||
myExceptions = (Set<TypeRepr.AbstractType>)RW.read(externalizer, new THashSet<TypeRepr.AbstractType>(0), in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -22,6 +22,7 @@ import com.intellij.util.io.KeyDescriptor;
|
||||
import com.intellij.util.io.PersistentHashMap;
|
||||
import gnu.trove.TObjectObjectProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
@@ -53,7 +54,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
return collection == null? NULL_COLLECTION : collection;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -66,7 +67,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
return myMap.containsMapping(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
myMap.remove(key);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
myMap.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,13 +224,13 @@ public class ObjectObjectPersistentMultiMaplet<K, V extends Streamable> extends
|
||||
return procedure.execute(key, myMap.get(key));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.jetbrains.jps.builders.java.dependencyView;
|
||||
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import org.jetbrains.asm4.Opcodes;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -45,7 +46,7 @@ class Proto implements RW.Savable, Streamable {
|
||||
name = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ class Proto implements RW.Savable, Streamable {
|
||||
DataInputOutputUtil.writeINT(out, name);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -17,6 +17,7 @@ package org.jetbrains.jps.builders.java.dependencyView;
|
||||
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -69,7 +70,7 @@ abstract class ProtoMember extends Proto {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
|
||||
assert (false);
|
||||
@@ -84,7 +85,7 @@ abstract class ProtoMember extends Proto {
|
||||
myValue = loadTyped(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +124,7 @@ abstract class ProtoMember extends Proto {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.util.io.DataInputOutputUtil;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
@@ -59,7 +60,7 @@ public class RW {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,13 +75,13 @@ public class RW {
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException c) {
|
||||
throw new RuntimeException(c);
|
||||
throw new BuildDataCorruptedException(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ public class RW {
|
||||
}
|
||||
}
|
||||
catch (IOException c) {
|
||||
throw new RuntimeException(c);
|
||||
throw new BuildDataCorruptedException(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ public class RW {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ public class RW {
|
||||
return result;
|
||||
}
|
||||
catch (IOException x) {
|
||||
throw new RuntimeException(x);
|
||||
throw new BuildDataCorruptedException(x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public class RW {
|
||||
return acc;
|
||||
}
|
||||
catch (IOException x) {
|
||||
throw new RuntimeException(x);
|
||||
throw new BuildDataCorruptedException(x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ public class RW {
|
||||
return acc;
|
||||
}
|
||||
catch (IOException x) {
|
||||
throw new RuntimeException(x);
|
||||
throw new BuildDataCorruptedException(x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +175,7 @@ public class RW {
|
||||
w.newLine();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +198,7 @@ public class RW {
|
||||
return r.readLine();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.io.DataExternalizer;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -68,7 +69,7 @@ class TypeRepr {
|
||||
DataInputOutputUtil.writeINT(out, type);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ class TypeRepr {
|
||||
type = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ class TypeRepr {
|
||||
elementType.save(out);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +191,7 @@ class TypeRepr {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ class TypeRepr {
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-14
@@ -20,6 +20,7 @@ import com.intellij.util.io.DataInputOutputUtil;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -82,7 +83,7 @@ class UsageRepr {
|
||||
myOwner = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myOwner);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ class UsageRepr {
|
||||
myType = TypeRepr.externalizer(context).read(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ class UsageRepr {
|
||||
myReturnType = externalizer.read(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ class UsageRepr {
|
||||
myArity = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +301,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myArity);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +354,7 @@ class UsageRepr {
|
||||
myClassName = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +365,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myClassName);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +411,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myClassName);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +433,7 @@ class UsageRepr {
|
||||
myClassName = DataInputOutputUtil.readINT(in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +444,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myClassName);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +487,7 @@ class UsageRepr {
|
||||
DataInputOutputUtil.writeINT(out, myClassName);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +574,7 @@ class UsageRepr {
|
||||
myUsedTargets = (EnumSet<ElemType>)RW.read(elementTypeExternalizer, EnumSet.noneOf(ElemType.class), in);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +587,7 @@ class UsageRepr {
|
||||
RW.save(myUsedTargets, elementTypeExternalizer, out);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.jps.builders.storage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This exception indicates that some internal build storage cannot be loaded or saved properly. Rebuild will be requested to recover from
|
||||
* the corruption.
|
||||
*
|
||||
* @author nik
|
||||
*/
|
||||
public class BuildDataCorruptedException extends RuntimeException {
|
||||
public BuildDataCorruptedException(IOException cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized IOException getCause() {
|
||||
return (IOException)super.getCause();
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import org.jetbrains.jps.builders.java.JavaBuilderUtil;
|
||||
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.logging.ProjectBuilderLogger;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.builders.storage.SourceToOutputMapping;
|
||||
import org.jetbrains.jps.cmdline.BuildRunner;
|
||||
import org.jetbrains.jps.cmdline.ProjectDescriptor;
|
||||
@@ -194,30 +195,31 @@ public class IncProjectBuilder {
|
||||
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) {
|
||||
|
||||
myMessageDispatcher.processMessage(new CompilerMessage(
|
||||
"", BuildMessage.Kind.INFO,
|
||||
"Internal caches are corrupted or have outdated format, forcing project rebuild: " +
|
||||
e.getMessage())
|
||||
);
|
||||
throw new RebuildRequestedException(cause);
|
||||
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);
|
||||
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.equals(causeMessage)? errMessage : errMessage + ": " + causeMessage);
|
||||
final String causeMessage = cause != null ? cause.getMessage() : "";
|
||||
msg = new CompilerMessage("", BuildMessage.Kind.ERROR, StringUtil.isEmptyOrSpaces(causeMessage) || errMessage.equals(causeMessage)
|
||||
? errMessage
|
||||
: errMessage + ": " + causeMessage);
|
||||
}
|
||||
myMessageDispatcher.processMessage(msg);
|
||||
}
|
||||
@@ -226,7 +228,7 @@ public class IncProjectBuilder {
|
||||
memWatcher.stop();
|
||||
flushContext(context);
|
||||
// wait for async tasks
|
||||
final CanceledStatus status = context == null? CanceledStatus.NULL : context.getCancelStatus();
|
||||
final CanceledStatus status = context == null ? CanceledStatus.NULL : context.getCancelStatus();
|
||||
synchronized (myAsyncTasks) {
|
||||
for (Future task : myAsyncTasks) {
|
||||
if (status.isCanceled()) {
|
||||
@@ -238,6 +240,13 @@ public class IncProjectBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private void requestRebuild(Exception e, Throwable cause) throws RebuildRequestedException {
|
||||
myMessageDispatcher.processMessage(new CompilerMessage("", BuildMessage.Kind.INFO,
|
||||
"Internal caches are corrupted or have outdated format, forcing project rebuild: " +
|
||||
e.getMessage()));
|
||||
throw new RebuildRequestedException(cause);
|
||||
}
|
||||
|
||||
private static void waitForTask(@NotNull CanceledStatus status, Future task) {
|
||||
try {
|
||||
while (true) {
|
||||
@@ -851,6 +860,9 @@ public class IncProjectBuilder {
|
||||
// }));
|
||||
//}
|
||||
}
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (ProjectBuildException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.builders.logging.ProjectBuilderLogger;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.cmdline.ProjectDescriptor;
|
||||
import org.jetbrains.jps.incremental.*;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
@@ -191,6 +192,9 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
|
||||
return compile(context, chunk, dirtyFilesHolder, filesToCompile, outputConsumer);
|
||||
}
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (ProjectBuildException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.jps.builders.DirtyFilesHolder;
|
||||
import org.jetbrains.jps.builders.FileProcessor;
|
||||
import org.jetbrains.jps.builders.java.ResourceRootDescriptor;
|
||||
import org.jetbrains.jps.builders.java.ResourcesTargetType;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
import org.jetbrains.jps.incremental.ProjectBuildException;
|
||||
import org.jetbrains.jps.incremental.ResourcesTarget;
|
||||
@@ -96,6 +97,9 @@ public class ResourcesBuilder extends TargetBuilder<ResourceRootDescriptor, Reso
|
||||
|
||||
context.processMessage(new ProgressMessage(""));
|
||||
}
|
||||
catch(BuildDataCorruptedException e) {
|
||||
throw e;
|
||||
}
|
||||
catch(ProjectBuildException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
import org.jetbrains.jps.builders.BuildTarget;
|
||||
import org.jetbrains.jps.builders.impl.BuildTargetChunk;
|
||||
import org.jetbrains.jps.builders.impl.storage.BuildTargetStorages;
|
||||
@@ -101,7 +102,7 @@ public class BuildDataManager implements StorageOwner {
|
||||
return new SourceToOutputMappingImpl(new File(getSourceToOutputMapRoot(key), "data"));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new BuildDataCorruptedException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -236,12 +237,8 @@ public class BuildDataManager implements StorageOwner {
|
||||
try {
|
||||
mappings.close();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof IOException) {
|
||||
throw ((IOException)cause);
|
||||
}
|
||||
throw e;
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,12 +291,8 @@ public class BuildDataManager implements StorageOwner {
|
||||
try {
|
||||
return lazy.getValue();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof IOException) {
|
||||
throw (IOException)cause;
|
||||
}
|
||||
throw e;
|
||||
catch (BuildDataCorruptedException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user