Fixed - deprecation error log about JSON config even though it's not used #3196

pull/3209/head
Nikita Koksharov 4 years ago
parent f327ee84a2
commit 963bc0347f

@ -113,11 +113,11 @@ public class RedissonRegionFactory implements RegionFactory {
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));
return Config.fromYAML(new File(configPath));
} catch (IOException e) {
// trying next format
try {
return Config.fromYAML(new File(configPath));
return Config.fromJSON(new File(configPath));
} catch (IOException e1) {
throw new CacheException("Can't parse default yaml config", e1);
}
@ -128,11 +128,11 @@ public class RedissonRegionFactory implements RegionFactory {
InputStream is = classLoader.getResourceAsStream(fileName);
if (is != null) {
try {
return Config.fromJSON(is);
return Config.fromYAML(is);
} catch (IOException e) {
try {
is = classLoader.getResourceAsStream(fileName);
return Config.fromYAML(is);
return Config.fromJSON(is);
} catch (IOException e1) {
throw new CacheException("Can't parse yaml config", e1);
}

@ -111,11 +111,11 @@ import java.util.Properties;
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));
return Config.fromYAML(new File(configPath));
} catch (IOException e) {
// trying next format
try {
return Config.fromYAML(new File(configPath));
return Config.fromJSON(new File(configPath));
} catch (IOException e1) {
throw new CacheException("Can't parse default yaml config", e1);
}
@ -126,11 +126,11 @@ import java.util.Properties;
InputStream is = classLoader.getResourceAsStream(fileName);
if (is != null) {
try {
return Config.fromJSON(is);
return Config.fromYAML(is);
} catch (IOException e) {
try {
is = classLoader.getResourceAsStream(fileName);
return Config.fromYAML(is);
return Config.fromJSON(is);
} catch (IOException e1) {
throw new CacheException("Can't parse yaml config", e1);
}

@ -111,11 +111,11 @@ public class RedissonRegionFactory implements RegionFactory {
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));
return Config.fromYAML(new File(configPath));
} catch (IOException e) {
// trying next format
try {
return Config.fromYAML(new File(configPath));
return Config.fromJSON(new File(configPath));
} catch (IOException e1) {
throw new CacheException("Can't parse default yaml config", e1);
}
@ -126,11 +126,11 @@ public class RedissonRegionFactory implements RegionFactory {
InputStream is = classLoader.getResourceAsStream(fileName);
if (is != null) {
try {
return Config.fromJSON(is);
return Config.fromYAML(is);
} catch (IOException e) {
try {
is = classLoader.getResourceAsStream(fileName);
return Config.fromYAML(is);
return Config.fromJSON(is);
} catch (IOException e1) {
throw new CacheException("Can't parse yaml config", e1);
}

@ -120,11 +120,11 @@ public class RedissonRegionFactory extends RegionFactoryTemplate {
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));
return Config.fromYAML(new File(configPath));
} catch (IOException e) {
// trying next format
try {
return Config.fromYAML(new File(configPath));
return Config.fromJSON(new File(configPath));
} catch (IOException e1) {
throw new CacheException("Can't parse default yaml config", e1);
}
@ -135,11 +135,11 @@ public class RedissonRegionFactory extends RegionFactoryTemplate {
InputStream is = classLoader.getResourceAsStream(fileName);
if (is != null) {
try {
return Config.fromJSON(is);
return Config.fromYAML(is);
} catch (IOException e) {
try {
is = classLoader.getResourceAsStream(fileName);
return Config.fromYAML(is);
return Config.fromJSON(is);
} catch (IOException e1) {
throw new CacheException("Can't parse yaml config", e1);
}

@ -331,11 +331,11 @@ public class RedissonSessionManager extends ManagerBase {
protected RedissonClient buildClient() throws LifecycleException {
Config config = null;
try {
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
} catch (IOException e) {
// trying next format
try {
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
} catch (IOException e1) {
log.error("Can't parse json config " + configPath, e);
throw new LifecycleException("Can't parse yaml config " + configPath, e1);

@ -331,11 +331,11 @@ public class RedissonSessionManager extends ManagerBase {
protected RedissonClient buildClient() throws LifecycleException {
Config config = null;
try {
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
} catch (IOException e) {
// trying next format
try {
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
} catch (IOException e1) {
log.error("Can't parse json config " + configPath, e);
throw new LifecycleException("Can't parse yaml config " + configPath, e1);

@ -331,11 +331,11 @@ public class RedissonSessionManager extends ManagerBase {
protected RedissonClient buildClient() throws LifecycleException {
Config config = null;
try {
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
} catch (IOException e) {
// trying next format
try {
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
} catch (IOException e1) {
log.error("Can't parse json config " + configPath, e);
throw new LifecycleException("Can't parse yaml config " + configPath, e1);

@ -48,11 +48,11 @@ public class JndiRedissonFactory implements ObjectFactory {
protected RedissonClient buildClient(String configPath) throws NamingException {
Config config = null;
try {
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
} catch (IOException e) {
// trying next format
try {
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
} catch (IOException e1) {
NamingException ex = new NamingException("Can't parse yaml config " + configPath);
ex.initCause(e1);

@ -98,27 +98,27 @@ public class JCachingProvider implements CachingProvider {
private Config loadConfig(URI uri) {
Config config = null;
try {
URL jsonUrl = null;
URL yamlUrl = null;
if (DEFAULT_URI_PATH.equals(uri.getPath())) {
jsonUrl = JCachingProvider.class.getResource("/redisson-jcache.json");
yamlUrl = JCachingProvider.class.getResource("/redisson-jcache.yaml");
} else {
jsonUrl = uri.toURL();
yamlUrl = uri.toURL();
}
if (jsonUrl == null) {
throw new IOException();
if (yamlUrl != null) {
config = Config.fromYAML(yamlUrl);
}
config = Config.fromJSON(jsonUrl);
} catch (IOException e) {
try {
URL yamlUrl = null;
URL jsonUrl = null;
if (DEFAULT_URI_PATH.equals(uri.getPath())) {
yamlUrl = JCachingProvider.class.getResource("/redisson-jcache.yaml");
jsonUrl = JCachingProvider.class.getResource("/redisson-jcache.json");
} else {
yamlUrl = uri.toURL();
jsonUrl = uri.toURL();
}
if (yamlUrl != null) {
config = Config.fromYAML(yamlUrl);
if (jsonUrl == null) {
throw new IOException();
}
config = Config.fromJSON(jsonUrl);
} catch (IOException e2) {
// skip
}

Loading…
Cancel
Save