ProviderInfo now returns "Unspecified" for unknown packages without version info.

This commit is contained in:
Harald Kuhr 2009-11-03 14:49:48 +01:00
parent 9c443f28e3
commit 67b985bc1d
2 changed files with 8 additions and 3 deletions

View File

@ -34,7 +34,7 @@ public class ProviderInfo {
mVendorName = vendor != null ? vendor : fakeVendor(pPackage);
String version = pPackage.getImplementationVersion();
mVersion = version != null ? version : "DEV";
mVersion = version != null ? version : fakeVersion(pPackage);
}
private static String fakeVendor(final Package pPackage) {
@ -42,6 +42,11 @@ public class ProviderInfo {
return name.startsWith("com.twelvemonkeys") ? "TwelveMonkeys" : name;
}
private String fakeVersion(Package pPackage) {
String name = pPackage.getName();
return name.startsWith("com.twelvemonkeys") ? "DEV" : "Unspecified";
}
/**
* Returns the vendor name, as specified in the manifest entry
* {@code Implementation-Vendor} for the package.

View File

@ -26,7 +26,7 @@ public class ProviderInfoTestCase extends TestCase {
}
}
public void testGetVendorNonJARPackage() {
public void testGetVendorUnknownNonJARPackage() {
ProviderInfo info = new ProviderInfo(mockNonJARPackage("org.foo"));
String vendor = info.getVendorName();
@ -35,7 +35,7 @@ public class ProviderInfoTestCase extends TestCase {
String version = info.getVersion();
assertNotNull(version);
assertEquals("DEV", version);
assertEquals("Unspecified", version);
}
public void testGetVendorNonJARTMPackage() {