Skip to content

Commit a66b8c6

Browse files
committed
Merge pull request #96 from jayunit100/version-defense
Version defense
2 parents 7ca2421 + 8375d73 commit a66b8c6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/org/apache/hadoop/fs/glusterfs/Version.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@
44

55
import java.util.Properties;
66

7+
import org.slf4j.Logger;
8+
import org.slf4j.LoggerFactory;
9+
710
/**
811
* Versioning stuff for the shim. This class is not tested since there is no
912
* deterministic behaviour (i.e. it might not work if not building from binary),
1013
* and the effects are pure side effects.
1114
*/
1215
public class Version extends Properties{
16+
static final Logger LOG = LoggerFactory.getLogger(Version.class);
1317
public Version() {
1418
super();
1519
try{
1620
load(this.getClass().getClassLoader().getResourceAsStream("git.properties"));
1721
}
1822
catch(Throwable t){
19-
throw new RuntimeException("Couldn't find git properties for version info " + t.getMessage());
23+
LOG.warn("Couldn't find GIT properties for version info " +
24+
t.getMessage()+". This jar may have been built OUTSIDE a GIT repo.");
2025
}
2126
}
2227
public String getTag(){
23-
return this.getProperty("git.commit.id.describe").split("-")[0];
28+
String commit = this.getProperty("git.commit.id.describe");
29+
String tag = commit != null ?
30+
commit.split("-")[0]:
31+
"no version info available. check log warnings.";
32+
return commit.split("-")[0];
2433
}
2534

2635
/**

0 commit comments

Comments
 (0)