Add a double-wrap of tempContexts around the example call to MetaDataAction for the example, to avoid warning about creating a system-user session w/o an instance in context.

This commit is contained in:
2025-03-12 20:18:06 -05:00
parent 955cb67a2c
commit 8cf53e045e

View File

@ -242,6 +242,12 @@ public class MetaDataSpecV1 extends AbstractEndpointSpec<MetaDataInput, MetaData
.withChild(exampleTable);
exampleInstance.addApp(exampleApp);
//////////////////////////////////////////////////////////////////////////////////////////////////////
// double-wrap the context here, so the instance will exist when the system-user-session is created //
// to avoid warnings out of system-user-session about there not being an instance in context. //
//////////////////////////////////////////////////////////////////////////////////////////////////////
QContext.withTemporaryContext(new CapturedContext(exampleInstance, null), () ->
{
QContext.withTemporaryContext(new CapturedContext(exampleInstance, new QSystemUserSession()), () ->
{
try
@ -256,10 +262,10 @@ public class MetaDataSpecV1 extends AbstractEndpointSpec<MetaDataInput, MetaData
}
catch(Exception e)
{
examples.put("Example", new Example().withValue("Error building example: " + e.getMessage())
);
examples.put("Example", new Example().withValue("Error building example: " + e.getMessage()));
}
});
});
return new BasicResponse("""
Overall metadata for the application.""",