Check for nonexistant git.properties
Change-Id: I1821416abb0387ee05b9add9f9c15798deed25d2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1453
Reviewed-by: Michael Blow <mblow@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java
index 492282c..1f503ec 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java
@@ -234,9 +234,14 @@
private void loadAsterixBuildProperties() throws AsterixException {
Properties gitProperties = new Properties();
try {
- gitProperties.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
- for (final String name : gitProperties.stringPropertyNames()) {
- asterixBuildProperties.put(name, gitProperties.getProperty(name));
+ InputStream propertyStream = getClass().getClassLoader().getResourceAsStream("git.properties");
+ if (propertyStream != null) {
+ gitProperties.load(propertyStream);
+ for (final String name : gitProperties.stringPropertyNames()) {
+ asterixBuildProperties.put(name, gitProperties.getProperty(name));
+ }
+ } else {
+ LOGGER.info("Build properties not found on classpath. Version API will return empty object");
}
} catch (IOException e) {
throw new AsterixException(e);