Check for nonexistant git.properties Change-Id: I1821416abb0387ee05b9add9f9c15798deed25d2 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1453 Reviewed-by: Michael Blow <mb...@apache.org> Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/f3588fa2 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/f3588fa2 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/f3588fa2 Branch: refs/heads/release-0.8.9 Commit: f3588fa291368d3519acdbecf26528efb5720d6b Parents: e2cf491 Author: Ian Maxon <ima...@apache.org> Authored: Wed Jan 18 15:58:18 2017 -0800 Committer: Ian Maxon <ima...@apache.org> Committed: Wed Jan 18 18:17:56 2017 -0800 ---------------------------------------------------------------------- .../apache/asterix/common/config/PropertiesAccessor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f3588fa2/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java ---------------------------------------------------------------------- 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 @@ public class PropertiesAccessor { 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);