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) { private Config loadConfig(String configPath) {
try { try {
return Config.fromJSON(new File(configPath)); return Config.fromYAML(new File(configPath));
} catch (IOException e) { } catch (IOException e) {
// trying next format // trying next format
try { try {
return Config.fromYAML(new File(configPath)); return Config.fromJSON(new File(configPath));
} catch (IOException e1) { } catch (IOException e1) {
throw new CacheException("Can't parse default yaml config", 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); InputStream is = classLoader.getResourceAsStream(fileName);
if (is != null) { if (is != null) {
try { try {
return Config.fromJSON(is); return Config.fromYAML(is);
} catch (IOException e) { } catch (IOException e) {
try { try {
is = classLoader.getResourceAsStream(fileName); is = classLoader.getResourceAsStream(fileName);
return Config.fromYAML(is); return Config.fromJSON(is);
} catch (IOException e1) { } catch (IOException e1) {
throw new CacheException("Can't parse yaml config", e1); throw new CacheException("Can't parse yaml config", e1);
} }

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

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

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

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

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

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

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

Loading…
Cancel
Save