Skip to content

Commit

Permalink
fix: default public namespace error
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhouyu committed Nov 30, 2024
1 parent 589afad commit aa8e847
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@

package com.alibaba.nacos.core.utils;

import com.alibaba.nacos.api.common.Constants;
import com.alibaba.nacos.common.paramcheck.ParamCheckResponse;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.core.namespace.repository.NamespacePersistService;
import com.alibaba.nacos.sys.utils.ApplicationUtils;

import java.util.Objects;

/**
* <p>
* namespace checker util.
Expand All @@ -37,14 +40,14 @@ private NamespaceParamCheckUtils() {

/**
* check namespaceId exists.
* if namespace is null or empty. return true.
* if namespace is null or empty or default public. return true.
* else query namespace by id. when not exists,then return false.
* @param namespaceId namespaceId
* @return paramCheckResponse
*/
public static ParamCheckResponse checkNamespaceExists(String namespaceId) {
ParamCheckResponse paramCheckResponse = new ParamCheckResponse();
if (StringUtils.isEmpty(namespaceId)) {
if (StringUtils.isEmpty(namespaceId) || Objects.equals(Constants.DEFAULT_NAMESPACE_ID, namespaceId)) {
paramCheckResponse.setSuccess(true);
return paramCheckResponse;
}
Expand Down

0 comments on commit aa8e847

Please sign in to comment.