Skip to content

Commit

Permalink
Prevent NPE on page refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
copierrj committed Jun 7, 2024
1 parent 59c778d commit f0da5f7
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,21 +378,23 @@ public String getTitle() throws ClassNotFoundException {
return fileName;
}

Workspace workspace = OGCFrontController.getServiceWorkspace().getNewWorkspace();
Class<?> cls = workspace.getModuleClassLoader().loadClass(resourceProviderClass);
ResourceMetadata<?> md = workspace.getResourceMetadata((Class) cls, id);

if (md == null) {
// lookup path if file will be created from template
ResourceManager<?> mgr = lookupResourceManager(workspace, cls);
if (mgr != null) {
return mgr.getMetadata().getWorkspacePath() + "/" + id;
if (resourceProviderClass != null) {
Workspace workspace = OGCFrontController.getServiceWorkspace().getNewWorkspace();
Class<?> cls = workspace.getModuleClassLoader().loadClass(resourceProviderClass);
ResourceMetadata<?> md = workspace.getResourceMetadata((Class) cls, id);

if (md == null) {
// lookup path if file will be created from template
ResourceManager<?> mgr = lookupResourceManager(workspace, cls);
if (mgr != null) {
return mgr.getMetadata().getWorkspacePath() + "/" + id;
}
}
}
else {
for (ResourceManager<? extends Resource> resourceManager : workspace.getResourceManagers()) {
if (resourceManager.getProviders().contains(md.getProvider())) {
return resourceManager.getMetadata().getWorkspacePath() + "/" + id;
else {
for (ResourceManager<? extends Resource> resourceManager : workspace.getResourceManagers()) {
if (resourceManager.getProviders().contains(md.getProvider())) {
return resourceManager.getMetadata().getWorkspacePath() + "/" + id;
}
}
}
}
Expand Down

0 comments on commit f0da5f7

Please sign in to comment.