mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
- do not allow set incorrect path
- avoid removing read only files (cherry picked from commit b480932)
This commit is contained in:
committed by
Anna Kozlova
parent
e183125b99
commit
03e45cc030
@@ -102,6 +102,9 @@ public class TestDiscoveryIndex implements ProjectComponent {
|
||||
}
|
||||
|
||||
public void setRemoteTestRunDataPath(String path) {
|
||||
if(!TestInfoHolder.isValidPath(path)) {
|
||||
path = null;
|
||||
}
|
||||
myRemoteTestRunDataController.init(path);
|
||||
// todo: should we remove our local run data ?
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ final class TestInfoHolder {
|
||||
try {
|
||||
int version = readVersion(versionFile);
|
||||
if (version != VERSION) {
|
||||
assert !readOnly;
|
||||
TestDiscoveryIndex.LOG.info("TestDiscoveryIndex was rewritten due to version change");
|
||||
deleteAllIndexDataFiles(methodQNameToTestNameFile,
|
||||
testNameToUsedClassesAndMethodMapFile,
|
||||
@@ -285,6 +286,14 @@ final class TestInfoHolder {
|
||||
return myDisposed;
|
||||
}
|
||||
|
||||
public static boolean isValidPath(String path) {
|
||||
try {
|
||||
return readVersion(getVersionFile(path)) == VERSION;
|
||||
} catch (IOException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TestNamesExternalizer implements DataExternalizer<TIntArrayList> {
|
||||
public void save(@NotNull DataOutput dataOutput, TIntArrayList testNameIds) throws IOException {
|
||||
for (int testNameId : testNameIds.toNativeArray()) DataInputOutputUtil.writeINT(dataOutput, testNameId);
|
||||
|
||||
Reference in New Issue
Block a user