Skip to content

Commit 4935d72

Browse files
authored
Issue 53253: forego indexing data class in a container being deleted (#6821)
1 parent e05f770 commit 4935d72

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

experiment/src/org/labkey/experiment/api/ExpDataClassImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ public Domain getDomain(boolean forUpdate)
242242
{
243243
if (_domain == null || (forUpdate && !_domain.isMutable()))
244244
{
245+
assert getContainer() != null : "Container cannot be null when attempting to fetch data class domain.";
246+
245247
_domain = PropertyService.get().getDomain(getContainer(), getLSID(), forUpdate);
246248
if (_domain == null)
247249
{
@@ -328,12 +330,9 @@ public void delete(User user, @Nullable String auditUserComment)
328330
}
329331
}
330332

331-
public TableInfo getTinfo()
333+
public @NotNull TableInfo getTinfo()
332334
{
333-
Domain d = getDomain();
334-
if (null == d)
335-
throw new NullPointerException("domain is null");
336-
return StorageProvisioner.createTableInfo(d);
335+
return StorageProvisioner.createTableInfo(getDomain());
337336
}
338337

339338
@Override

experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,13 +1219,8 @@ public void indexDataClass(ExpDataClassImpl dataClass)
12191219
SearchService.IndexTask task = ss.defaultTask();
12201220

12211221
Runnable r = () -> {
1222-
Domain d = dataClass.getDomain();
1223-
if (d == null)
1224-
return; // Domain may be null if the DataClass has been deleted
1225-
1226-
TableInfo table = dataClass.getTinfo();
1227-
if (table == null)
1228-
return;
1222+
if (dataClass.getContainer() == null)
1223+
return; // Issue 53253: container may be deleted
12291224

12301225
indexDataClass(dataClass, task);
12311226
indexDataClassData(dataClass, task);
@@ -1830,13 +1825,7 @@ public ExpDataClassImpl getDataClass(int rowId)
18301825
@Override
18311826
public List<? extends ExpData> getExpDatas(ExpDataClass dataClass)
18321827
{
1833-
Domain d = dataClass.getDomain();
1834-
if (d == null)
1835-
throw new IllegalStateException("No domain for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
1836-
18371828
TableInfo table = ((ExpDataClassImpl) dataClass).getTinfo();
1838-
if (table == null)
1839-
throw new IllegalStateException("No table for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
18401829

18411830
SQLFragment sql = new SQLFragment()
18421831
.append("SELECT * FROM ").append(getTinfoData(), "d")
@@ -1849,7 +1838,6 @@ public List<? extends ExpData> getExpDatas(ExpDataClass dataClass)
18491838
return datas.stream().map(ExpDataImpl::new).collect(toList());
18501839
}
18511840

1852-
18531841
public List<ExpDataImpl> getExpDatasByObjectId(ContainerFilter containerFilter, Collection<Integer> objectIds)
18541842
{
18551843
SimpleFilter filter = new SimpleFilter();
@@ -1862,13 +1850,7 @@ public List<ExpDataImpl> getExpDatasByObjectId(ContainerFilter containerFilter,
18621850
@Nullable
18631851
public ExpDataImpl getExpData(ExpDataClass dataClass, String name)
18641852
{
1865-
Domain d = dataClass.getDomain();
1866-
if (d == null)
1867-
throw new IllegalStateException("No domain for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
1868-
18691853
TableInfo table = ((ExpDataClassImpl) dataClass).getTinfo();
1870-
if (table == null)
1871-
throw new IllegalStateException("No table for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
18721854

18731855
SQLFragment sql = new SQLFragment()
18741856
.append("SELECT * FROM ").append(getTinfoData(), "d")
@@ -1886,13 +1868,7 @@ public ExpDataImpl getExpData(ExpDataClass dataClass, String name)
18861868
@Nullable
18871869
public ExpDataImpl getExpData(ExpDataClass dataClass, int rowId)
18881870
{
1889-
Domain d = dataClass.getDomain();
1890-
if (d == null)
1891-
throw new IllegalStateException("No domain for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
1892-
18931871
TableInfo table = ((ExpDataClassImpl) dataClass).getTinfo();
1894-
if (table == null)
1895-
throw new IllegalStateException("No table for DataClass '" + dataClass.getName() + "' in container '" + dataClass.getContainer().getPath() + "'");
18961872

18971873
SQLFragment sql = new SQLFragment()
18981874
.append("SELECT * FROM ").append(getTinfoData(), "d")
@@ -10226,6 +10202,7 @@ else if (currentDataType instanceof ExpSampleType sampleType)
1022610202
}
1022710203
}
1022810204

10205+
@SuppressWarnings("JUnitMalformedDeclaration")
1022910206
public static class TestCase extends Assert
1023010207
{
1023110208
final Logger log = LogManager.getLogger(ExperimentServiceImpl.class);
@@ -10389,6 +10366,7 @@ public void setPath(String path)
1038910366
}
1039010367
}
1039110368

10369+
@SuppressWarnings("JUnitMalformedDeclaration")
1039210370
public static class LineageQueryTestCase extends Assert
1039310371
{
1039410372
TempTableTracker tt;
@@ -10587,6 +10565,7 @@ public void testCycle()
1058710565
}
1058810566
}
1058910567

10568+
@SuppressWarnings("JUnitMalformedDeclaration")
1059010569
public static class ParseInputOutputAliasTestCase extends Assert
1059110570
{
1059210571
@Test

0 commit comments

Comments
 (0)