Skip to content

Commit

Permalink
[HWORKS-958] 3.5 add project null check for FeaturestoreService
Browse files Browse the repository at this point in the history
  • Loading branch information
ErmiasG authored Jan 24, 2024
1 parent b686b7c commit 8937048
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
import io.hops.hopsworks.api.filter.NoCacheResponse;
import io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired;
import io.hops.hopsworks.common.api.ResourceRequest;
import io.hops.hopsworks.common.dao.project.ProjectFacade;
import io.hops.hopsworks.common.featurestore.FeaturestoreController;
import io.hops.hopsworks.common.featurestore.FeaturestoreDTO;
import io.hops.hopsworks.common.featurestore.keyword.KeywordDTO;
import io.hops.hopsworks.common.featurestore.metadata.FeatureStoreKeywordControllerIface;
import io.hops.hopsworks.common.featurestore.settings.FeaturestoreClientSettingsDTO;
import io.hops.hopsworks.common.project.ProjectController;
import io.hops.hopsworks.common.util.Settings;
import io.hops.hopsworks.exceptions.FeaturestoreException;
import io.hops.hopsworks.exceptions.ProjectException;
import io.hops.hopsworks.jwt.annotation.JWTRequired;
import io.hops.hopsworks.persistence.entity.project.Project;
import io.hops.hopsworks.persistence.entity.user.security.apiKey.ApiScope;
Expand Down Expand Up @@ -76,7 +77,7 @@ public class FeaturestoreService {
@EJB
private FeaturestoreController featurestoreController;
@EJB
private ProjectFacade projectFacade;
private ProjectController projectController;
@EJB
private Settings settings;
@Inject
Expand Down Expand Up @@ -105,8 +106,8 @@ public class FeaturestoreService {
*
* @param projectId the id of the project
*/
public void setProjectId(Integer projectId) {
this.project = projectFacade.find(projectId);
public void setProjectId(Integer projectId) throws ProjectException {
this.project = projectController.findProjectById(projectId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public InferenceResource infer(@PathParam("projectId") Integer projectId) {
}

@Path("{projectId}/featurestores")
public FeaturestoreService featurestoreService(@PathParam("projectId") Integer projectId) {
public FeaturestoreService featurestoreService(@PathParam("projectId") Integer projectId) throws ProjectException {
featurestoreService.setProjectId(projectId);
return featurestoreService;
}
Expand Down

0 comments on commit 8937048

Please sign in to comment.