Skip to content

Commit f61f03e

Browse files
committed
Projects.get/list must not return uninitialized projects #11532
1 parent 445987a commit f61f03e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

modules/core/core-project/src/main/java/com/enonic/xp/core/impl/project/ProjectServiceImpl.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import com.enonic.xp.project.ProjectRole;
6565
import com.enonic.xp.project.ProjectService;
6666
import com.enonic.xp.project.Projects;
67+
import com.enonic.xp.repository.BranchNotFoundException;
6768
import com.enonic.xp.repository.DeleteRepositoryParams;
6869
import com.enonic.xp.repository.Repositories;
6970
import com.enonic.xp.repository.Repository;
@@ -688,18 +689,22 @@ private PropertyTree createContentRootData( final CreateProjectParams params )
688689

689690
private SiteConfigs getProjectSiteConfigs( final ProjectName projectName )
690691
{
691-
final PropertyTree contentRootData;
692+
final Node contentRoot;
692693
try
693694
{
694-
contentRootData =
695-
contentRootDataContext( projectName ).callWith( () -> nodeService.getByPath( ContentConstants.CONTENT_ROOT_PATH ).data() );
695+
contentRoot =
696+
contentRootDataContext( projectName ).callWith( () -> nodeService.getByPath( ContentConstants.CONTENT_ROOT_PATH ) );
697+
if ( contentRoot == null )
698+
{
699+
return null;
700+
}
696701
}
697-
catch ( RepositoryNotFoundException e )
702+
catch ( RepositoryNotFoundException | BranchNotFoundException e )
698703
{
699704
return null;
700705
}
701706

702-
return getProjectSiteConfigs( contentRootData );
707+
return getProjectSiteConfigs( contentRoot.data() );
703708
}
704709

705710
private SiteConfigs getProjectSiteConfigs( final PropertyTree contentRootData )

modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/NodeServiceImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,11 @@ public FindNodesByMultiRepoQueryResult findByQuery( final MultiRepoNodeQuery mul
381381
trace.put( "filter", multiNodeQuery.getNodeQuery().getQueryFilters() );
382382
trace.put( "from", multiNodeQuery.getNodeQuery().getFrom() );
383383
trace.put( "size", multiNodeQuery.getNodeQuery().getSize() );
384-
trace.put( "repo", ContextAccessor.current().getRepositoryId().toString() );
385-
trace.put( "branch", ContextAccessor.current().getBranch() );
386384
}, () -> executeFindByQuery( multiNodeQuery ), ( trace, result ) -> trace.put( "hits", result.getTotalHits() ) );
387385
}
388386

389387
private FindNodesByMultiRepoQueryResult executeFindByQuery( final MultiRepoNodeQuery nodeQuery )
390388
{
391-
verifyContext();
392389
return FindNodesByMultiRepoQueryCommand.create()
393390
.query( nodeQuery )
394391
.indexServiceInternal( this.indexServiceInternal )

0 commit comments

Comments
 (0)