mirror of
https://github.com/apache/lucene.git
synced 2025-02-22 10:15:27 +00:00
LUCENE-1666: if JAR has null impl version, fallback to Lucene's main version; also add main version in, if the JAR's impl version doesn't contain it
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@779625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3c3b283e3c
commit
6dcd9628f5
@ -56,10 +56,10 @@ public final class Constants {
|
||||
|
||||
public static final String LUCENE_VERSION;
|
||||
|
||||
public static final String LUCENE_MAIN_VERSION = "2.9-dev";
|
||||
public static final String LUCENE_MAIN_VERSION = "2.9";
|
||||
|
||||
static {
|
||||
String v = LUCENE_MAIN_VERSION;
|
||||
String v = LUCENE_MAIN_VERSION + "-dev";
|
||||
try {
|
||||
// TODO: this should have worked, but doesn't seem to?
|
||||
// Package.getPackage("org.apache.lucene.util").getImplementationVersion();
|
||||
@ -69,7 +69,14 @@ public final class Constants {
|
||||
try {
|
||||
Manifest manifest = new Manifest(s);
|
||||
Attributes attr = manifest.getMainAttributes();
|
||||
v = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
|
||||
String value = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
|
||||
if (value != null) {
|
||||
if (value.indexOf(LUCENE_MAIN_VERSION) == -1) {
|
||||
v = value + " [" + LUCENE_MAIN_VERSION + "]";
|
||||
} else {
|
||||
v = value;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (s != null) {
|
||||
s.close();
|
||||
|
@ -71,7 +71,7 @@ public class TestCheckIndex extends LuceneTestCase {
|
||||
public void testLuceneConstantVersion() throws IOException {
|
||||
// common-build.xml sets lucene.version
|
||||
final String version = System.getProperty("lucene.version");
|
||||
assertEquals(version, Constants.LUCENE_MAIN_VERSION);
|
||||
assertEquals(version, Constants.LUCENE_MAIN_VERSION+"-dev");
|
||||
assertTrue(Constants.LUCENE_VERSION.startsWith(version));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user