Skip to content

Commit

Permalink
[HWORKS-958] add null check for FeaturestoreService
Browse files Browse the repository at this point in the history
  • Loading branch information
ErmiasG authored Jan 31, 2024
1 parent aeb774b commit 20d009f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
import io.hops.hopsworks.api.kafka.KafkaResource;
import io.hops.hopsworks.api.auth.key.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.featurestore.Featurestore;
import io.hops.hopsworks.persistence.entity.project.Project;
Expand Down Expand Up @@ -81,7 +82,7 @@ public class FeaturestoreService {
@EJB
private FeaturestoreController featurestoreController;
@EJB
private ProjectFacade projectFacade;
private ProjectController projectController;
@EJB
private Settings settings;
@Inject
Expand Down Expand Up @@ -112,8 +113,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 @@ -725,9 +725,9 @@ public InferenceResource infer(@PathParam("projectId") Integer projectId) {
inference.setProjectId(projectId);
return inference;
}

@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 20d009f

Please sign in to comment.