Skip to content

Commit

Permalink
[CALCITE-3521] CalciteSystemProperty failed to load config file
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyuan authored and danny0405 committed Nov 30, 2019
1 parent 82311f5 commit 67e9367
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.calcite.config;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;

import java.io.File;
Expand Down Expand Up @@ -362,9 +363,11 @@ private static CalciteSystemProperty<String> stringProperty(

private static Properties loadProperties() {
Properties saffronProperties = new Properties();
ClassLoader classLoader = MoreObjects.firstNonNull(
Thread.currentThread().getContextClassLoader(),
CalciteSystemProperty.class.getClassLoader());
// Read properties from the file "saffron.properties", if it exists in classpath
try (InputStream stream = CalciteSystemProperty.class.getClassLoader()
.getResourceAsStream("saffron.properties")) {
try (InputStream stream = classLoader.getResourceAsStream("saffron.properties")) {
if (stream != null) {
saffronProperties.load(stream);
}
Expand Down

0 comments on commit 67e9367

Please sign in to comment.