Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CacheDirUtil read properties #12185

Closed
shalk opened this issue Jun 6, 2024 · 0 comments · Fixed by #12186
Closed

fix CacheDirUtil read properties #12185

shalk opened this issue Jun 6, 2024 · 0 comments · Fixed by #12186

Comments

@shalk
Copy link
Contributor

shalk commented Jun 6, 2024

Describe the bug
CacheDirUtil have a method initCacheDir. code as follow

    public static String initCacheDir(String namespace, NacosClientProperties properties) {
        
        String jmSnapshotPath = System.getProperty(JM_SNAPSHOT_PATH_PROPERTY);
        
        String namingCacheRegistryDir = "";
        if (properties.getProperty(PropertyKeyConst.NAMING_CACHE_REGISTRY_DIR) != null) {
            namingCacheRegistryDir =
                    File.separator + properties.getProperty(PropertyKeyConst.NAMING_CACHE_REGISTRY_DIR);
        }
        
        if (!StringUtils.isBlank(jmSnapshotPath)) {
            cacheDir = jmSnapshotPath + File.separator + FILE_PATH_NACOS + namingCacheRegistryDir + File.separator
                    + FILE_PATH_NAMING + File.separator + namespace;
        } else {
            cacheDir =
                    System.getProperty(USER_HOME_PROPERTY) + File.separator + FILE_PATH_NACOS + namingCacheRegistryDir
                            + File.separator + FILE_PATH_NAMING + File.separator + namespace;
        }
        
        return cacheDir;
    }

It use System.getProperty to read properties, but since #8622 client properties can be read from NacosClientProperties, so user can configure properties from different source.

I think this is changed by this pr

I will fix it.

Expected behavior
client read properties from NacosClientProperties

Actually behavior
client read properties from System.getProperty

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See errors

Desktop (please complete the following information):

  • OS: [e.g. Centos]
  • Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant